(define-module (palindrome)) (define-public (pp str) "Pretty-printer wrapper for palindrome?" (format #f "String ~a is ~aa palindrome!\n" str (if (palindrome? str) "" "not "))) (define-public (palindrome? str) "Returns #t if STR is a palindrome, false otherwise. Ignores casing and non-alphabetic characters." (let ((clean (cleanup str))) (equal? clean (string-reverse clean)))) (define (cleanup str) (string-downcase (string-filter char-set:letter str)))