Bookmark and Share

Beginning Clojure

What would be a better way to start the autumn season than learning a new programming language?

Like most earthlings, I have been programming using the imperative paradigm exclusively: C, C++, Java, MATLAB, procedural/OO Python, PHP, whatever. With or without objects, with static or dynamic typing, the fundamental idea is always the same, derived from how the processor works under the hood: the execution flows from one statement to next and the program’s state changes accordingly. The programmer’s job is to form the statements and flow such that the state changes represent something meaningful. An opposite approach is declarative programming, where the programmer’s job is, curiously enough, to describe what the program should accomplish, rather than how to accomplish something. This sounds like total black magic, so I definitely had to find out what it is about.

I did some research and found two hot modern languages that run on the JVM and include functional features. The newer one, Clojure, is barely two years old. I was also considering Scala, but after some research I couldn’t convince myself that it were more than “somewhat improved Java” (Or degraded? See this article, this comment and these complexity comparisons between Scala and Clojure: 1, 2). Add to the top that I was looking for something completely different, so Clojure was a clear choice. (Disclaimer: of course I’m unable to compare the quality or usefulness of the two languages when I haven’t yet learned nor used either of them. Please don’t accuse me of making an unfair choice. What I write here is based on my first impressions, and no one can deny them.)

So I purchased my copy of Programming Clojure and installed the necessary tools to start trying it out. The principal IDE, Enclojure, is actually a plugin for the NetBeans IDE, which is par excellent choice (as is Clojure’s choice to run on the JVM). I doubt there has ever been any other programming language with this fine overall environment ready at this early stage — mere two years after its first publication. It does make a difference. Give me the finest language in the world with weak tools, and I’m not interested. From the viewpoint of a real-world programmer, a programming language is never a separate entity. It’s a combination of the language, the libraries and tools available, and of course, documentation and community. Clojure’s first impression in this respect is very, very good. It has the feel of a polished product regardless that it only recently reached the magical version number 1.0.

I won’t type here yet another detailed description of what Clojure is, because it has been already written so well for so many times. I just say that the functional approach of Clojure is mind-blowing to an old-school programmer like me. Perhaps I’m going to write some articles on it once I get more into it. Meanwhile, here’s a concise collection of most useful Clojure links.

Official Clojure sites
The main site.
Clojure development is going on here.
The place for discussions on Clojure.

Official Enclojure sites
The NetBeans IDE plugin. The .nbm also installs Clojure the language (clojure-1.0.0.jar) and the libraries (clojure-contrib-1.0.0.jar) into NetBeans’ Library Manager.
Enclojure development is going on here.
The place for discussions on Enclojure.

Clojure learning resources
The first (and so far the only) book on Clojure.
Mark Volkmann’s Clojure page, lots of links and information, especially — maybe the best online tutorial on Clojure.
Another online tutorial.
Yet another online tutorial.
Solutions for Project Euler problems in Clojure.
Clojure Cheat Sheet (html).
Clojure Cheat Sheet (pdf).
Stuart Halloway’s (author of Programming Clojure) presentations, sample codes, etc.
Stuart Halloway’s blog.
Structure and Interpretation of Computer Programs in Clojure.
Getting Started in Clojure’s Assembla Wiki covers setting up various IDEs and editors.
Last modified: 2010-04-18 16:25 +0300

blog comments powered by Disqus