I’m a software engineer at my day job, and I’m a long-time programming language junkie. Every so often I find that I need to spend time learning a new programming language, just to keep my brain working freely. Just recently I’ve been experimenting with a language called Clojure.
Fair warning: the remainder of this post is going to be mondo geeky.
Clojure is yet another variant of LISP, which is itself one of the oldest computer languages in the world. I’ve never written any production code in LISP, but every five or ten years I come back to it, see what’s going on, and have my brain stretched. There are things that are easily done in LISP that are impossible in most languages, and it’s always fun to learn more about them, and get ideas to take back to my regular work.
The problem with LISP is that historically it hasn’t played nicely with others. LISP usually wants to be the entire programming environment: you do all of your work in LISP, and interact with the operating system only through LISP’s platform abstractions, which (in the case of Common LISP) are often old and out of step with the rest of the programming world. Moreover, even Common LISP hasn’t always been cross-platform—every LISP system is a little bit different. In my day job, I’ve never been in a position to consider using only LISP for a project; and these days I’m not going to do any serious application development at home unless the result project is cross-platform. Thus, although I’ve enjoyed playing with LISP from time to time, I haven’t made a serious effort to write a full application in it since the mid-1980’s.
The author of Clojure, on the other hand, explicitly trys to make it play well with others. Clojure is a LISP, but it’s an unusual LISP. Rich Hickey has simplified the language in some ways, and extended it in others, and the result is a heck of a lot easier to get your head around than the behemoth that is Common Lisp. It targets the Java JVM: it can seamlessly make use of libraries written in Java, and you can write libraries in Clojure to be used by Java code. All of the standard facilities available to Java code are available to Clojure, right down to the Swing GUI libraries: you can write GUI applications in Clojure just as you would in Java. And the number of third-party libraries available to Java coders is massive; it’s an enormous community, and the Clojure world gets to take advantage of that.
And not only is Clojure a LISP-like language, with all of the neat toys that that implies, not only can it seamlessly work with Java code—not only that, it’s actually gaining some traction with real working programmers. There’s always been a lunatic fringe (a scary-smart lunatic fringe, mind you) devoted to LISP, but this is the first time since the late ’80’s that I’ve seen any movement to use LISP by the wider programming community. And that’s very cool.
So I’m learning Clojure.
So, then—if you want to learn a language like Clojure, how do you get started? As I’ve always said, it helps to have the right tools; and since I’ve spent a couple of weeks figuring out what they are, I’ll share that with you in another post.