[Haskell-cafe] *GROUP HUG*

Don Stewart dons00 at gmail.com
Thu Jun 2 01:15:53 CEST 2011


http://stackoverflow.com/questions/6172004/writing-foldl-using-foldr/6172270#6172270

Thank Graham Hutton and Richard Bird.

On Wed, Jun 1, 2011 at 7:12 PM, Tom Murphy <amindfv at gmail.com> wrote:
>>
>> 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 at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>



More information about the Haskell-Cafe mailing list