aboutsummaryrefslogtreecommitdiff
path: root/rosetta/palindrome.neb
diff options
context:
space:
mode:
authormryouse2023-06-03 20:22:18 +0000
committermryouse2023-06-03 20:22:18 +0000
commit7b7bf727da3250907284368b98b0083a4b4e2386 (patch)
tree34802caea5181dc0fb97992746ab99b080448418 /rosetta/palindrome.neb
initial commit
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)))