summaryrefslogtreecommitdiff
path: root/palindrome.scm
diff options
context:
space:
mode:
Diffstat (limited to 'palindrome.scm')
-rwxr-xr-xpalindrome.scm16
1 files changed, 16 insertions, 0 deletions
diff --git a/palindrome.scm b/palindrome.scm
new file mode 100755
index 0000000..788fa06
--- /dev/null
+++ b/palindrome.scm
@@ -0,0 +1,16 @@
+#!/run/current-system/profile/bin/guile \
+-e main -s
+!#
+
+
+(define (main args)
+ (format #t "String was ~aa palindrome!\n"
+ (if (palindrome? (cleanup (car (cdr args))))
+ "" "not ")))
+
+(define (cleanup str)
+ (string-downcase (string-filter
+ char-set:letter str)))
+
+(define (palindrome? str)
+ (equal? str (string-reverse str)))