Skip to content

Instantly share code, notes, and snippets.

@shigemk2
Created February 4, 2015 11:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shigemk2/a13f3c98a1c824eb80ff to your computer and use it in GitHub Desktop.
Save shigemk2/a13f3c98a1c824eb80ff to your computer and use it in GitHub Desktop.
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