-
-
Save yedi/8d4e4bd76669846874c7 to your computer and use it in GitHub Desktop.
yedi's palindrome solution
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
((fn palin [x] | |
(if | |
(empty? (seq [x])) | |
true | |
(if (= (first (seq x)) (last (seq x))) | |
(and true (palin (rest (butlast (seq x))))) | |
false))) [1 2 3 2 1]) | |
((fn palin [x] | |
(if | |
(empty? (seq [x])) | |
true | |
(if (= (first (seq x)) (last (seq x))) | |
(and true (palin (rest (butlast (seq x))))) | |
false))) "racecar") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment