A Caesar cipher is a very simple kind of encoding of alphabetic text (like English)
in which each letter in the text is replaced by another letter some fixed number of
positions down the alphabet. For example, the string
“hello”
can be replaced by a Caesar cipher one letter down the alphabet to the following:
“ifmmp”
One can write a function in Clojure to carry out a substitution, as in:
Working out a Caesar cipher could make for a useful introductory Clojurebridge exercise.
It would provide a way to interact with the core functions of the Clojure language, and one
can add in a bit of motivation with the encrypted message itself (if, say, the encrypted
message describes the location of a small prize).
An example of building a Caesar cipher might proceed as follows: