Re: foldl, tail recursion, and strictness (was: stack overflow)

2001-02-26 Thread George Russell
I know it's complete heresy to say so, but I use laziness very little in Haskell, while I probably pay quite a lot for it in CPU time and memory, because of all those thunks which have to be stored. However I prefer Haskell's type classes, syntax and purity to, say, Standard ML. So I wonder whet

Re: foldl, tail recursion, and strictness (was: stack overflow)

2001-02-26 Thread Ketil Malde
"C.Reinke" <[EMAIL PROTECTED]> writes: > So foldl is indeed tail recursive, but this doesn't help if its > operator isn't strict because the tail recursion only builds up the > expression to be evaluated. Making strictness explicit by defining a > variant of foldl that evaluates its accumulator a

foldl, tail recursion, and strictness (was: stack overflow)

2001-02-26 Thread C.Reinke
"Julian Assange" <[EMAIL PROTECTED]>: > .. > | When used with a 170k input file, makemap suffers from a stack > | overflow. foldl should be tail recursive. What's the score? "Simon Peyton-Jones" <[EMAIL PROTECTED]>: > Consider > foldl (+) 0 [x1,x2,x3,x4,... > > This rewrites to > >