-
-
Save priort/cda52093a1998d736f7a3b03e9da2c7a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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