Nightcode is a clojure IDE that comes bundled with other tools in the clojure development stack.
Download and install Java 7 or Java 8
Download Nightcode 1.0.1 from the link below into a tools folder like ~/tools/nightcode
Open a command shell and type java -jar <path to nightcode download>
. For example, if you have downloaded Nightcode to ~/tools/nightcode
type the following in a command shell.
java -jar ~/tools/nightcode/nightcode-1.0.1-standalone.jar
To open a command shell,
On Windows:
(Windows Key + R) and then type cmd
and enter
On Mac:
(Command Key + Space) and then type terminal
and enter
Once Nightcode is loaded, verify that you have the complete clojure stack by typing command in the Clojure REPL.
The clojure Read-Eval-Print-Loop or REPL console is at the bottom left corner of Nightcode. To evaluate an expression in the REPL, type in the expression and press enter as shown below
clojure.core=>(reduce + [1 2 3 4 5])
When you press enter at the end of the line you should see the following:
clojure.core=> (reduce + [1 2 3 4 5])
15
clojure.core=>
This confirms you have successfully installed Nightcode. Congratulations!
Follow the steps below to clone a new project from a git repository. For this example we will clone the git repository at https://github.com/clojurebridge-minneapolis/clojure-koans.git
- Click
New Project
- Select a folder location for your project, type in your project name (say CBB) in the
File Name
form and clickSave
. - On the
Specify Project Type
screen, clickDownload
. In theGit address
field, type in the address https://github.com/clojurebridge-minneapolis/clojure-koans.git and clickClone Project
The git project is now cloned and available for editing in Nightcode.
Create a new Nightcode project cloned from the Clojure Koans git project at https://github.com/clojurebridge-minneapolis/clojure-koans.git
To run the Koans, do the following
- In the Nightcode project files panel on the left, select the file src/koans/01_equalities.clj. This will open the file in the editing panel.
- Click
Run with REPL
- Click
Reload
- Click
Eval
. You will see an assertion failure like the one below
ExceptionInfo We shall contemplate truth by testing reality, via equality
(= __ true) clojure.core/ex-info (core.clj:4327)
- Modify the code in the file as below and click
Eval
again
"We shall contemplate truth by testing reality, via equality"
(= true true)
You will now see that this assertion passed successfully and you a failure on the next assertion.
- Modify the code in the next assertion to make it pass and continue on to all the assertions in the file by clicking
Eval
every time you modify the code. The keyboard shortcut(Command + E)
to eval can be used to quickly evaluate your answers as you modify the code. Don't forget to save the file after you complete the koans in this file.