Skip to content

Instantly share code, notes, and snippets.

@shigemk2

shigemk2/elem.hs

Created Feb 4, 2015
Embed
What would you like to do?
elem' :: (Eq a) => a -> [a] -> Bool
elem' y ys = foldr (\x acc -> if x == y then True else acc) False ys
main = do
print $ elem' 4 [1,2,3]
print $ elem' 3 [1,2,3]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment