
1 Jun
2011
1 Jun
'11
7:15 p.m.
http://stackoverflow.com/questions/6172004/writing-foldl-using-foldr/6172270...
Thank Graham Hutton and Richard Bird.
On Wed, Jun 1, 2011 at 7:12 PM, Tom Murphy
How about this:
myFoldr :: (a -> b -> b) -> b -> [a] -> b myFoldr f z xs = foldl' (\s x v -> s (x `f` v)) id xs $ z
Cheers, Ivan
Great! Now I really can say "Come on! It's fun! I can write foldr with foldl!"
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe