CIS 554 Clojure Exercises
Fall 2014, David Matuszek

Purposes of this assignment

General idea of the assignment

This assignment is simply to write, and test, the same functions you wrote for Erlang.

The point of this assignment is to familiarize you with the syntax of Clojure. You have already figured out the logic for all of the functions, and the logic is largely unchanged from the way you did it in Erlang. So this is a way to concentrate on the syntax, without also having to figure out the logic.


Write and test the following functions. If in doubt about the purpose of any of them, see the corresponding Erlang assignment.

  • collatz(n)
  • shallow-reverse(lst)
  • remove-duplicates(lst)
  • my-flatten(lst)
  • skeleton(lst)
  • deep-reverse(lst)
  • eliminate(value, lst)
  • quicksort(lst)
  • zap-gremlins(text)
  • rot-13(text)
  • sqrt(n)
  • longest-collatz(lo, hi)

Notice the following differences:

Unit tests

I have provided unit tests for some of the functions on exercises-test.clj. Use these as a model, and test the remaining functions.


Clojure is supplied as a jar file. To run it, go to the command line, navigate to where the jar is stored, and enter: java -jar .\clojure-1.6.0.jar

To help with parentheses, a decent text editor is essential. Emacs is probably the best--after all, it's written in Lisp. Sublime Text and Notepad++ are also good. For the more adventurous, Light Table has an "Instarepl" that is more powerful than any REPL that I have previously encountered.

Due date

Turn your assignment in to Canvas before 6am Wednesday, October 8.