Browse Source

Problem 06

completed
Craige McWhirter 7 months ago
parent
commit
6beaf01d53
Signed by: craige GPG Key ID: 7DBA9F5689EFB6AA
  1. 13
      isPalindrome.hs

13
isPalindrome.hs

@ -0,0 +1,13 @@
{-# LANGUAGE StandaloneDeriving #-}
{-# OPTIONS_GHC -Wno-orphans #-}
-- Find out whether a list is a palindrome. A palindrome can be read forward or
-- backward; e.g. (x a m a x).
-- reverse: creates a new string from the original one with items in the reverse
-- order
isPalindrome :: (Eq a) => [a] -> Bool
isPalindrome [] = True
isPalindrome [_] = True
isPalindrome xs = xs == (reverse xs)
Loading…
Cancel
Save