Skip to content

Instantly share code, notes, and snippets.

@priort

priort/HaskellIntro5.hs Secret

Created Dec 30, 2018
Embed
What would you like to do?
isPalindrome :: String -> Bool
isPalindrome [] = True
isPalindrome (x : []) = True
isPalindrome (x1 : x2 : []) = x1 == x2 -- this line is not necessary, thanks Szymon
isPalindrome (x1 : xs) = x1 == last xs && isPalindrome (init xs)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.