Exercise: Fun with Palindromes
These exercises will give you more experience using strings and the
Simple Palendrome Checker
A Palindrome is a word that is spelt the same whether it is written backwards or forwards. So when you reverse the word it should still look the same.
Can you write a simple expression to see if a word, e.g. "radar", is a palindrome.
You will need to reverse the word and compare (see if it is equal) to the original word.
Using a function called
reverse in the
;; Is the reverse of the string "radar" equal to the string "radar" (= "radar" (clojure.string/reverse "radar"))
You could use the generic
reverse function in
clojure.core, however this returns a list the individual characters in reverse order, rather than reversing the string as a single value.