aboutsummaryrefslogtreecommitdiff
path: root/rosetta/palindrome.neb
diff options
context:
space:
mode:
authormryouse2022-08-02 02:16:38 +0000
committermryouse2022-08-02 02:16:38 +0000
commitee509e05746731b12afe64bfe34284b119f6b4ae (patch)
tree3a7e2e2ea668a99ab979e5852eedb661d9723085 /rosetta/palindrome.neb
parent7300580eb3aacfe1b67918fb20259e3ec26559c2 (diff)
exercises
Diffstat (limited to 'rosetta/palindrome.neb')
-rw-r--r--rosetta/palindrome.neb6
1 files changed, 6 insertions, 0 deletions
diff --git a/rosetta/palindrome.neb b/rosetta/palindrome.neb
new file mode 100644
index 0000000..198456d
--- /dev/null
+++ b/rosetta/palindrome.neb
@@ -0,0 +1,6 @@
+(func palindrome? (str)
+ (branch
+ ((<= (length str) 1) #true)
+ ((eq? (first str) (last str))
+ (palindrome? (reverse (rest (reverse (rest str))))))
+ (#true #false)))