fork(3) download
  1. (defun palindrome-p (str)
  2. (let ((str (remove-if-not #'alpha-char-p str)))
  3. (string-equal str (reverse str))))
  4.  
  5. (defun check-palindrome (str)
  6. (format t "~s is ~:[NOT ~;~]a palindrome.~%"
  7. str (palindrome-p str)))
  8.  
  9. (check-palindrome "boo")
  10. (check-palindrome "A man, a plan, a cat, a ham, a yak, a yam, a hat, a canal-Panama!")
  11. (check-palindrome "A tin mug for a jar of gum, Nita.")
  12. (check-palindrome "A Toyota! Race fast, safe car! A Toyota!")
Success #stdin #stdout 0.02s 10584KB
stdin
Standard input is empty
stdout
"boo" is NOT a palindrome.
"A man, a plan, a cat, a ham, a yak, a yam, a hat, a canal-Panama!" is a palindrome.
"A tin mug for a jar of gum, Nita." is a palindrome.
"A Toyota! Race fast, safe car! A Toyota!" is a palindrome.