This Clojure programming assignment focuses on using higher level functions in Clojure.
Implement the following functions:
(rot13 text)
text
. This is a
simple encoding where each letter (upper and lower case) is replaced
by the letter 13 characters ahead, with wrapping. Both uppercase
and lowercase letters should be rotated. All other characters
should be unaffected. For example, (rot13 "Alan
Garvey")
returns the name of my nemesis "Nyna Tneirl"
.
You may want to use the coercions (int
ch)
and (char n)
. Make sure your result is a
string. Hint: map
.(zap-chars chars text)
text
with all of
the characters in chars
removed. For example,
(zap-chars "Aa" "Alan Garvey")
should return "ln Grvey".
Hint: filter
(shallow-reverse lst)
lst
. For example, the
list (1 (2 3) 4)
returns the list (4 (2 3)
1)
. You are not to use the built-in
Clojure reverse
function or the code that you see if
you look at the source of the Clojure reverse
function.(deep-reverse lst)
lst
at all levels. For
example, if lst
is (1 (2 (3 4 5)) (2 3))
returns ((3 2) ((5 4 3) 2) 1)
. As above, you are not
to use the built-in Clojure reverse
function or the
code that you see if you look at the source of the
Clojure reverse
function.You should hand in a printout of a single well-documented file containing all of the code required to run the system. You should also upload your Clojure file. When I receive your printout, I will find your uploaded file and grade your assignment. By default the "ontime-ness" of an assignment is defined by the timestamp on the uploaded file.
Recall that as part of the writing-enhanced nature of this course, I will be carefully evaluating both the functionality of your code as well as its clarity, organization, presentation and style.