[Haskell-cafe] Would you mind explain such a code ?

zaxis z_axis at 163.com
Thu Sep 10 02:20:30 EDT 2009


myFoldl :: (a -> b -> a) -> a -> [b] -> a

myFoldl f z xs = foldr step id xs z
    where step x g a = g (f a x)

I know myFoldl implements foldl using foldr. However i really donot know how
it can do it ?

Please shed a light one me, thanks!
-- 
View this message in context: http://www.nabble.com/Would-you-mind-explain-such-a-code---tp25377949p25377949.html
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.



More information about the Haskell-Cafe mailing list