
8 Apr
2006
8 Apr
'06
7:08 p.m.
On 4/8/06, Tim Toorop
On the other hand, I think the new spiffy inits is quite clear once you notice why its map (const xn) $ undefined:xn
I think it would be even clearer if it were defined like this:
inits xs = zipWith take [0..] $ map (const xs) xs
That way you don't have this ugly special case for the first element in the list. But there is an even better advantage: it is strict again! So it's termination properties are exactly like the Prelude one. This version *can* be used as a drop-in replacement of the Prelude version. Cheers, /Josef