Skip to content

Instantly share code, notes, and snippets.

@yedi

yedi/palin Secret

Created December 1, 2011 21:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yedi/8d4e4bd76669846874c7 to your computer and use it in GitHub Desktop.
Save yedi/8d4e4bd76669846874c7 to your computer and use it in GitHub Desktop.
yedi's palindrome solution
((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