The idea of koans is that the student has to make only a very small, seemingly insignificant change to make each koan work. By crafting koans around language features, students gain focused knowledge around the individual features. The Ruby Koans (http://rubykoans.com) set the bar really high. The EdgeCase folks have made their koans fun, even amusing. Those who have done both sets will agree with the inside joke that the Scala koans are still on their journey toward the path to enlightenment.
If you want to try the Scala koans, they currently live in 2 places. We'll ultimately consolidate them with the Functional Koans on GitHub, but for now you can find the "solutions set" at https://bitbucket.org/dickwall/scala-koans and the student exercises at https://bitbucket.org/dmarsh/scalakoansexercises.
You can clone this repository using:
hg clone https://firstname.lastname@example.org/dmarsh/scalakoansexercises
The Ruby Koans have a script that generate the exercises from the working solutions set, but we're not there yet.
To run the koans, you need a JDK (1.6+). SBT http://code.google.com/p/simple-build-tool/ and scalatest (http://www.scalatest.org/) are packaged with the distribution here. SBT will bring in Scala for you.
For *nix, just run:
Note: You may need to change your sbt to be executable. For example,
> chmod +x ./sbt
Or for Windows:
Running the koans
We've just upgraded to Luke Amdor's runner (THANKS LUKE!) and to SBT 0.10. To start, type:
Once that's done, you can run all the koans with:
> ~test-only org.functionalkoans.forscala.Koans
Or, you can run specific koans (e.g., AboutAsserts) with:
> ~test-only org.functionalkoans.forscala.AboutAsserts
This will run the koans, and you will get a "Pending" status from the tests when the failure is a result of a "fill in the blank" error or an "Error" when you've filled it in with something wrong.
From that point on, you will be able to edit the Scala files and make appropriate changes to get the tests to work. sbt will run the tests when you make changes. Scroll back through the messages to the first error and make the change to fix the error.
Note: The work-in-process page on FindingYourPath will give you suggestions for which test to run, depending on your interest and background.
Additional koans have been added, but not yet integrated. We're in the process of separating beginner koans from advanced, and new koans will be released very soon. We're also adding some koans that represent doing some exercises.
I'll keep the wiki updated, as we make improvements.
The Scala Koans are a community project. Your contributions, whether they be code or merely opinions, are very welcome!
The Scala Koans are licensed as Creative Commons -- NonCommercial. http://creativecommons.org/licenses/by-nc-sa/3.0/