[Haskell-beginners] Palindromic solution??
tom.davie at gmail.com
Mon Feb 16 13:38:50 EST 2009
On 16 Feb 2009, at 19:30, Dave Bayer wrote:
> Here's a solution harder on the machine, easier on the brain:
> isPalindrome :: Eq a => [a] -> Bool
> isPalindrome xs = and $ zipWith (==) xs $ reverse xs
Lets just tidy that up a little...
isPalindrome = (and . zipWith (==)) <*> reverse
But I don't see how either is easier on the brain than xs == reverse xs.
More information about the Beginners