Skip to content

Instantly share code, notes, and snippets.

@kaveet
Last active November 23, 2016 02:12
Show Gist options
  • Save kaveet/061beb43f80aaffb3ecdecc99aefd2e0 to your computer and use it in GitHub Desktop.
Save kaveet/061beb43f80aaffb3ecdecc99aefd2e0 to your computer and use it in GitHub Desktop.
Haskell Map Implementation with Foldr
-- Problem 1: Redefine Haskell's map using foldr from the standard prelude
module MyMap where
map' :: (a -> b) -> [a] -> [b]
map' f [] = []
map' f (x:xs) = foldr (\y ys -> (f y):ys) [] xs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment