[Haskell-cafe] why does a foldr not have a space leak effect?
Albert Y. C. Lai
trebla at vex.net
Wed Jul 25 18:31:51 CEST 2012
On 12-07-25 09:06 AM, Mathieu Boespflug wrote:
> "Albert Y. C. Lai" <trebla at vex.net> writes:
>> foldr (+) and foldl (+) for Int have the same asymptotic costs, both
>> time and space. See my http://www.vex.net/~trebla/haskell/lazy.xhtml
>> Therefore, I do not understand why they are labeled opposite space-leakness.
> That may be true, but if the function argument supplied to foldr is lazy
> in its second argument, then the story can be quite different.
In my http://www.vex.net/~trebla/haskell/lazy.xhtml which I mentioned
yesterday, I have an example for that, too. foldr (||).
More information about the Haskell-Cafe