Bulat Ziganshin bulat.ziganshin at
Sat Apr 8 10:36:48 EDT 2006

Hello Sebastian,

Saturday, April 8, 2006, 5:43:44 PM, you wrote:

>> > inits xs = [] : (zipWith take [1..] $ map (const xs) xs)
> inits xs = [] : zipWith take [1..length xs] (repeat xs)

original defintion use a clever trick whci allows to not fully
evaluate list before proceeding. this will require less memory for
such lists as [1..10^6] and moreover it's the only way to work with
infinite lists

Best regards,
 Bulat                            mailto:Bulat.Ziganshin at

More information about the Libraries mailing list