summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoe Zhao <ztuowen@gmail.com>2015-01-31 19:35:16 +0800
committerJoe Zhao <ztuowen@gmail.com>2015-01-31 19:35:16 +0800
commitd7a259acf6ff7cdda231b489b3707d8948b6507c (patch)
treea8b0c776806cc40afd3fe5e53ea57c13c7452f0a
parentab8fe6397a6cbe1fefe08c21c6d6d7f6eff910bc (diff)
downloadh99-d7a259acf6ff7cdda231b489b3707d8948b6507c.tar.gz
h99-d7a259acf6ff7cdda231b489b3707d8948b6507c.tar.bz2
h99-d7a259acf6ff7cdda231b489b3707d8948b6507c.zip
p6
-rw-r--r--p6.hs11
1 files changed, 11 insertions, 0 deletions
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