On Wed, Jun 1, 2011 at 3:28 AM, Daniel Fischer <
daniel.is.fisc...@googlemail.com> wrote:

> On Wednesday 01 June 2011 12:25:06, Adrien Haxaire wrote:
> >  On Wed, 01 Jun 2011 11:46:36 +0200, Henning Thielemann wrote:
> > > Really, you can write foldr in terms of foldl? So far I was glad I
> > > could
> > > manage the opposite direction.
> >foldr (++) (repeat "No way! ")
>

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
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to