Setup
Clojure is hosted on SourceForge.
Feedback and discussion should occur on the Clojure Google Group. Please join us!
Community-supplied supplementary material and tips are on the Wiki. Feel free to contribute your expertise.
Clojure is delivered in a zip file containing a single .jar, clojure.jar, a readme, the CPL license and the source code in a src subdirectory. It uses the ASM 3.0 bytecode library, and the current alpha distribution includes it. Java 1.5 or greater is required.
Quick Start
In the directory in which you expanded clojure.zip, run:
java -cp clojure.jar clojure.lang.Repl
This will bring up a simple read-eval-print loop (REPL). Much of Clojure is defined in Clojure itself (in the boot.clj file included in the src directory of distribution), which is automatically loaded from the .jar file when Clojure starts.
When boot.clj is loaded you will have the language as described herein fully available.
Try:
user=> (+ 1 2 3)
6
user=> (. javax.swing.JOptionPane (showMessageDialog nil "Hello World"))
The REPL has very rudimentary editing. For a better experience, try running it via the JLine ConsoleRunner:
java -cp jline-0.9.91.jar:clojure.jar jline.ConsoleRunner clojure.lang.Repl
This will give you left/right arrow key navigation and up/down arrow command history.
Editing
Editing of Clojure code is greatly facilitated by using an editor that has parens-matching. Lennart Staflin has provided a Clojure mode for Emacs, which provides syntax highlighting, parens matching, and the ability to run Clojure in a secondary process and send code to be evaluated from the editor, and Jeffrey Chu has provided an enhanced Clojure mode for Emacs. Toralf Wittner has supplied a syntax file for VIM. Eric Thorsen and company are building enclojure, a Netbeans plugin for Clojure. Thanks to all!Debugging
I have had success debugging Clojure code with JSwat, specifically, version 3.16 on Mac OS X. You can start Clojure under JSwat, but with limited input capabilities. Better is to attach JSwat to a running instance of Clojure. You have to start Java with these flags to support remote debugging:Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n
Listening for transport dt_socket at address: 63657
Clojure
user=>