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.
|
|
Notice the following differences:
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.