Skip to content

Instantly share code, notes, and snippets.

@spion

spion/myequal.hs

Last active Aug 29, 2015
Embed
What would you like to do?
myequal :: Eq a => [a] -> [a] -> Bool
-- two empty lists are equal
myequal [] [] = True
-- two non-empty lists are equal when their first elements are equal and the remainder of the lists are also equal
myequal (x:xs) (y:ys) = x == y && myeqal xs ys
-- all other lists are not equal
myequal _ _ = False
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment