Skip to content

Instantly share code, notes, and snippets.

@trekawek
Created October 17, 2014 16:53
Show Gist options
  • Save trekawek/30941c293ff6938483b0 to your computer and use it in GitHub Desktop.
Save trekawek/30941c293ff6938483b0 to your computer and use it in GitHub Desktop.
Implementation of the left folding using right folding.
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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment