Languages / Language

2007

Clojure

A Lisp for the JVM, with strong opinions about simplicity.

Clojure is a modern Lisp, designed by Rich Hickey and released in 2007 after he spent two and a half years building it alone. It runs on the JVM (and, as ClojureScript, on JavaScript engines), which gave a brand-new language an entire industrial ecosystem on day one.

The core bet: immutability

Where most Lisps let you mutate, Clojure makes immutable, persistent data structures the default. “Persistent” here means structural sharing: you get a new version cheaply without copying the whole thing, thanks to hash array mapped tries. Because values never change under you, concurrency stops being a minefield. When you do need change, it is explicit and coordinated — atoms, refs with software transactional memory, and agents.

Simple made easy

Hickey is as known for his talks as his code. In Simple Made Easy he draws a sharp line between simple (not intertwined — decomplected) and easy (familiar, close at hand), and argues we constantly trade the first away for the second. It is a philosophy as much as a language: prefer plain data over objects, functions over methods, values over places.

  • Homoiconicity — code is data (Lisp’s gift), so macros are natural.
  • The REPL is the workshop: you grow a program while it runs.
  • spec and transducers extend the value-oriented idea to contracts and to composable transformation.

The people

  • Rich Hickey designed and built Clojure almost entirely alone, over about two and a half years, on savings he set aside so he could think without a client or an employer. No committee, no company mandate — one experienced Lisp and Java programmer deciding to get concurrency and state right. When he released it in 2007 he did it quietly, with a message to the Lisp community rather than a launch, and it spread by word of mouth among programmers who felt the same pains he did.

What made him different is how he works and thinks. He champions “hammock-driven development” — long stretches of deliberate thought away from the keyboard — and his conference talks (Simple Made Easy, The Value of Values, Are We There Yet?) are studied as closely as the language itself. The recurring theme is decomplecting: pulling apart the things we casually braid together — state and identity, value and place, easy and simple. Clojure is that philosophy compiled.

Landmark open-source projects

Try it

;; Lazy, infinite, immutable - the primes under 30.
(defn sieve [xs]
  (cons (first xs)
        (lazy-seq (sieve (remove #(zero? (mod % (first xs))) (rest xs))))))
(println (take-while #(< % 30) (sieve (iterate inc 2))))

Sources

See also: Lisp, Lambda Calculus.