[Haskell-cafe] foldl vs foldl'

Derek Elkins derek.a.elkins at gmail.com
Tue Nov 4 18:33:21 EST 2008


On Tue, 2008-11-04 at 15:08 -0800, Daryoush Mehrtash wrote:
> 
> Are there cases (function or list) where the result of foldl (or
> foldr)would be different that foldl' (or foldr')?

There is no foldr'.  And yes, foldl and foldl' are different functions
and thus return different results on some inputs; however, you almost
always want foldl' (v. foldl).  See
http://www.haskell.org/haskellwiki/Stack_overflow



More information about the Haskell-Cafe mailing list