Last active
November 23, 2016 02:12
-
-
Save kaveet/061beb43f80aaffb3ecdecc99aefd2e0 to your computer and use it in GitHub Desktop.
Haskell Map Implementation with Foldr
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
-- 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