
14 Oct
2011
14 Oct
'11
11:34 a.m.
2011/10/14 Yves Parès
(*) Anyway, is there a place where foldl is preferable over foldl' ?
To quote http://www.haskell.org/haskellwiki/Foldr_Foldl_Foldl' : "Usually the choice is between foldr and foldl', since foldl and foldl' are the same except for their strictness properties, so if both return a result, it must be the same. foldl' is the more efficient way to arrive at that result because it doesn't build a huge thunk. However, if the combining function is lazy in its first argument, foldl may happily return a result where foldl' hits an exception" The article also contains an example. Bas