Getting started
Download cs340-lab17.zip. It is an Eclipse project, so you can import it into Eclipse using File→Import…→General→Existing projects into workspace→Archive file. You should see a project called cs340-lab17 in your Eclipse workspace.
Your task
This is a Clojure review lab. It is intended to prepare you for Exam 2.
Complete the create-applicator, apply-to-sequence, apply-to-sequence-the-hard-way, and swapify functions in src/clojure_review2/core.clj
. Each function is described by a detailed comment with example inputs and expected results.
You can test your functions by running the command lein test
in a terminal window from the root of the project.
You can also start a Clojure REPL (in Eclipse) by right-clicking in core.clj
and choosing Clojure→Load file in REPL. This is very useful for testing your functions interactively.
Resources you may use
You may use your textbook, the course website, the Clojure MOOC website, the clojure.org website, and the clojuredocs.org website.
Note that this lab is not graded, but it is intended to be a (second) preview of Exam 2, so you should try to complete it using only the resources listed above (which you will also have access to for Exam 2.)
Solutions
Here are my solutions: lab17.clj. Do not look at these until you have completed all of the functions on your own.