CoffeeScript Koans - koans to learn CoffeeScript
When you first run the koans, you'll be presented with a runtime error and a stack trace indicating where the error occurred. Your goal is to make the error go away. As you fix each error, you should learn something about the CoffeeScript language and functional programming in general.
Your journey towards CoffeeScript enlightenment starts in the koans/AboutExpects.coffee file. These koans will be very simple, so don't overthink them! As you progress through more koans, more and more CoffeeScript syntax will be introduced which will allow you to solve more complicated problems and use more advanced techniques.
If you haven't already installed CoffeeScript then follow the installation instructions on the official CoffeeScript site to get set up.
Running the Koans from a Browser
coffee -c AboutExpects.coffee
I've included a Cake buildfile so from the top-level directory you can just type:
If you want to keep the original files intact, you can copy them to the completed-koans/ directory and use
to compile them to lib/koans/
Rinse and repeat until all tests turn green.
For this project I've used Watchr - I've provided a koans.watchr file that will automatically compile files as they are saved from the koans/ directory to the lib/koans/ directory.
The test runner used is Jasmine with a customized report viewer.
I've also included a simple AppleScript (ChromeReloadr.sh) that will refresh the front browser window tab if you are using a Mac and the Chrome browser, this is currently run automatically as part of 'cake build' or 'cake test'.
You should use the following files dependant on which OS you are running on:
- Mac OS X: koans-mac.watchr
- Linux: koans-linux.watchr
- Windows: koans-win.watchr
The Windows and Linux versions are currently the same as the Mac version only without the Applescript.
Inspirations & thanks
- Edgecase - for the great Ruby Koans
- Jeremy Ashkenas and the Coffeescript crew on GitHub - for making Coffeescript
- Daniel P. Friedman & Matthias Felleisen - for 'The Little LISPer' book, where it all started
This software is (c) 2011 Nigel Runnels-Moss and licensed under the MIT license (see LICENCE for details). Enjoy!