Friday, May 29, 2009

Clojure is a new dynamic programming language for the JVM. It is a dialect of Lisp that provides:

  1. Well defined concurrency semantics for all language features. Clojure requires a functional programming style, and as such variables are single assignment and most data is immutable. For mutable data, Clojure supplies a software transaction memory system.
  2. Total integration with the JVM. Clojure data elements are instances of java.lang.Number, java.lang.String, etc. There is no bridging of parallel type systems (for example, from a canonical C language implementation). Clojure code compiles directly to Java bytecode and can be profiled and debugged using standard tools. Access to Java code/libraries from Clojure is totally seamless.
  3. Collection types as first-class language features. There is syntax for dealing with sets, maps and vectors, and their implementations are have the same immutablility and concurrency semantics as the other data types.
  4. Macros. Coming from a Java background this is perhaps the coolest feature of Clojure.

There are several excellent introductions to the language. The "Clojure for Java Programmers" (first part, second part), assumes no familiarity with Lisp and is a decent introduction to the language. The version of the lecture for experienced Lisp programmers (first part, second part) goes into the language in much greater detail and is highly recommended. Once you have sat through the "non-Lisp" version you will have enough background to comprend the "Lisp" version.

No comments: