Go to file
2010-11-01 14:27:48 -04:00
src Eliminate .size in favor of count. 2010-10-29 10:45:47 -05:00
.gitignore ignore classes 2010-07-27 21:39:02 -05:00
epl-v10.html Include Eclipse license v10 (same as Clojure itself). 2010-11-01 14:27:48 -04:00
ideaboard.txt more ideas and upgraded to 1.2.0 2010-10-27 17:19:40 -05:00
project.clj Upgrade to Clojure 1.3.0-alpha1. 2010-10-29 10:07:11 -05:00
README.md Include Eclipse license v10 (same as Clojure itself). 2010-11-01 14:27:48 -04:00
repl.bat Upgrade to Clojure 1.3.0-alpha1. 2010-10-29 10:07:11 -05:00
repl.sh Upgrade to Clojure 1.3.0-alpha1. 2010-10-29 10:07:11 -05:00
run.bat Upgrade to Clojure 1.3.0-alpha1. 2010-10-29 10:07:11 -05:00
run.sh Upgrade to Clojure 1.3.0-alpha1. 2010-10-29 10:07:11 -05:00
test.bat Upgrade to Clojure 1.3.0-alpha1. 2010-10-29 10:07:11 -05:00
test.sh Upgrade to Clojure 1.3.0-alpha1. 2010-10-29 10:07:11 -05:00

Clojure Koans

The Clojure Koans are a fun and easy way to get started with Clojure - no experience assumed or required. Just follow the instructions below to start making tests pass!

Getting Started

The only things you need to run the Clojure Koans are:

  • JRE 1.5 or higher
  • clojure-1.3.0-alpha1.jar

clojure-1.3.0-alpha1.jar needs to be placed in a directory lib under this project.

You can use Leiningen (http://github.com/technomancy/leiningen) to automatically install the Clojure jar in the right place.

After you have leiningen installed, run

lein deps

which will download all dependencies you need to run the Clojure koans.

Running The Koans

To run the koans, simply run

run.sh

or, on Windows,

run.bat

You'll see something like this:

FAIL in clojure.lang.PersistentList$EmptyList@1 (equalities.clj:1)
We shall contemplate truth by testing reality, via equality.
expected: (= __ true)
  actual: (not (= nil true))

The output is telling you that you have a failing test in equalities.clj. So open that file up and make it pass! In general, you just fill in the blanks to make tests pass. Sometimes there are several (or even an infinite number) of correct answers: any of them will work in these cases.

The koans differ from normal TDD in that the tests are already written for you, so you'll have to pay close attention to the failure messages, because up until the very end, making a test pass just means that the next failure message comes up.

While it's very easy (especially at first) to just fill in the blanks making things pass, you should work slowly, making sure you understand why the answer is what it is. Enjoy your path to Clojure enlightenment!

Contributing

Patches are encouraged! Make sure the answer sheet still passes (test.sh, or test.bat on Windows), and send a pull request.

The file ideaboard.txt has lots of good places to start

Contributors (in order of appearance)

  • Aaron Bedra
  • Colin Jones
  • Eric Lavigne
  • Nuno Marquez

Credits

These exercises were started by Aaron Bedra of Relevance, Inc. in early 2010, as a learning tool for newcomers to functional programming. Aaron's macro-fu makes these koans extremely simple and fun to use, and to improve upon, and Relevance's initiative

Using the koans metaphor as a tool for learning a programming language started with the Ruby Koans by EdgeCase.

License

The use and distribution terms for this software are covered by the Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php) which can be found in the file epl-v10.html at the root of this distribution. By using this software in any fashion, you are agreeing to be bound by the terms of this license.