[Haskell-beginners] Palindromic solution??

Dave Bayer bayer at cpw.math.columbia.edu
Mon Feb 16 13:30:46 EST 2009


Here's a solution harder on the machine, easier on the brain:

isPalindrome :: Eq a => [a] -> Bool
isPalindrome xs = and $ zipWith (==) xs $ reverse xs

On Feb 16, 2009, at 1:04 PM, Thomas Davie wrote:

> isPalindrome xs = take l xs == (take l $ reverse xs)
>  where l = length xs `div` 2



More information about the Beginners mailing list