[Haskell-cafe] why does a foldr not have a space leak effect?

Albert Y. C. Lai trebla at vex.net
Tue Jul 24 19:21:43 CEST 2012


On 12-07-23 10:52 PM, Qi Qi wrote:
> Foldl has the space leak effect, and that's why foldl' has been
> recommended.

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.

Perhaps it is an intuition leak, not a space leak. That is, one of them 
fulfills your intuition, the other fails your intuition.



More information about the Haskell-Cafe mailing list