diff options
author | bd <bdunahu@operationnull.com> | 2024-05-18 14:34:37 -0600 |
---|---|---|
committer | bd <bdunahu@operationnull.com> | 2024-05-18 14:47:07 -0600 |
commit | 6eb36d8a2f317f2eb49832f3ee06f24204c9e4fb (patch) | |
tree | 3c6710d8116d8c3e65c070fa9fffc67ae653fcf9 /palindrome.scm |
Hello, Palindrome, & Number-Guesser code-bases
Diffstat (limited to 'palindrome.scm')
-rwxr-xr-x | palindrome.scm | 16 |
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))) |