inits

Christian Maeder maeder at tzi.de
Mon Apr 10 10:01:14 EDT 2006


Simon Marlow wrote:
>>> inits xs = [] : (zipWith take [1..] $ map (const xs) xs)
> 
> I propose to replace inits in Data.List with this one.  

I think such a function should not use arithmetics (comparisons of ints 
via take)

Christian

for finite lists "reverse . map reverse . tails . reverse" is quite good
(but it is 80% garbage collecting on my machine)


More information about the Libraries mailing list