From d7a259acf6ff7cdda231b489b3707d8948b6507c Mon Sep 17 00:00:00 2001 From: Joe Zhao Date: Sat, 31 Jan 2015 19:35:16 +0800 Subject: p6 --- p6.hs | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 p6.hs diff --git a/p6.hs b/p6.hs new file mode 100644 index 0000000..dc643eb --- /dev/null +++ b/p6.hs @@ -0,0 +1,11 @@ +import Control.Monad +import Control.Applicative + +isPalindrome :: Eq a => [a] -> Bool +isPalindrome xs = xs == reverse xs + +isPalindrome' :: (Eq a) => [a] -> Bool +isPalindrome' = liftM2 (==) id reverse + +isPalindrome'' :: (Eq a) => [a] -> Bool +isPalindrome'' = (==) <*> reverse -- cgit v1.2.3-70-g09d2