Skip to content

Instantly share code, notes, and snippets.



Created Feb 4, 2015
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