Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- map via foldr
- mapFoldR :: (a -> b) -> [a] -> [b]
- mapFoldR f xs = foldr (\x y -> (f x):y) [] xs
- -- tests
- test_mapFoldR = (map f xs) == (mapFoldR f xs)
- where f x = x + 1
- xs = [1..10]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement