Skip to content

Instantly share code, notes, and snippets.

@yitznewton
Created May 29, 2014 13:12
Show Gist options
  • Select an option

  • Save yitznewton/b4093e4ea8130e45ab9d to your computer and use it in GitHub Desktop.

Select an option

Save yitznewton/b4093e4ea8130e45ab9d to your computer and use it in GitHub Desktop.
Detecting a palindrome in Haskell
isPalindrome :: Eq a => [a] -> Bool
isPalindrome [] = True
isPalindrome (_:[]) = True
isPalindrome (x:xs)
| x == last xs = isPalindrome $ init xs
| otherwise = False
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment