inits

Josef Svenningsson josef.svenningsson at gmail.com
Mon Apr 10 06:06:16 EDT 2006


On 4/10/06, Simon Marlow <simonmarhaskell at gmail.com> wrote:
> >>inits xs = [] : (zipWith take [1..] $ map (const xs) xs)
>
> I propose to replace inits in Data.List with this one.  Objections about
> the relaxed strictness are noted, but I subscribe to the view that the
> original is more strict than necessary, and the general trend for
> Data.List functions is to be as lazy as possible.
>
Fair enough. But how does it play with list fusion? I know that both
(:) and zipWith are good producers but how does it work when they are
composed like this? And how does it compare with the strict version
which is just a call to zipWith (and must therefore be a good producer
I assume).

Cheers,

/Josef


More information about the Libraries mailing list