Created
November 18, 2014 06:25
-
-
Save weidagang/1f03d0cedfe9e0db9ae8 to your computer and use it in GitHub Desktop.
mapreduce.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
reduce :: (a -> b -> b) -> b -> [a] -> b | |
reduce f b [] = b | |
reduce f b (x:xs) = f x (reduce f b xs) | |
map :: (a -> b) -> [a] -> [b] | |
map f = reduce (\a b -> (f a) : b) [] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment