
10 Apr
2006
10 Apr
'06
5:49 a.m.
Spencer Janssen wrote:
Earlier today on the #haskell IRC channel, Tim Toorop (bolrod on #haskell) pointed out that Data.List.inits is rather slow, and proposed an alternative. After some collabrative tweaking, we came up with the following:
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. Cheers, Simon