Skip to content

Instantly share code, notes, and snippets.

View Bruno-366's full-sized avatar

Bruno-366

View GitHub Profile
@YusukeHosonuma
YusukeHosonuma / map_filter.hs
Created May 8, 2016 13:19
Haskell - implement map and filter functions by recursion and foldr versions.
-- | recursion version
map' :: (a -> b) -> [a] -> [b]
map' _ [] = []
map' f (x:xs) = f x : map' f xs
filter' :: (a -> Bool) -> [a] -> [a]
filter' _ [] = []
filter' f (x:xs)
| f x = x : (filter' f xs)