
10 Apr
2006
10 Apr
'06
10:06 a.m.
On 4/10/06, Simon Marlow
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