My tools for learning clojure

Here’s what I’m using to learn clojure.

I’m reading Clojure Programming by Chas Emerick, Brian Carper and Christophe Grand. I’m almost halfway through (just finished the chapter on macros).

I once blogged that tech books were broken, specifically that they were too long. I got the Kindle edition of this book, so I didn’t even check the size until just a few minutes ago (Amazon says it’s 632 pages). My problem with long tech books is that most of the space is used on uninteresting reference information like tables of possible enum values, long program listings, and minute details that I’m mostly not ready for. I don’t think these kinds of books promote learning, and pointed out that the 200-page books on my shelf were also the best for learning (and most were classics).

This book, although long, doesn’t have these problems. It’s a teaching narrative, with quick repl sessions and the longer examples are still very manageable. Perhaps clojure lends itself to be presented this way — the code for generating a maze fits on my iPhone, and a repl session is an ideal way to learn a language.

After presenting the basic building blocks, the book also takes time to show you idiomatic clojure. The perfect example is the chapter on macros. When I first tried to learn clojure, I struggled to learn macros and basically hacked my way towards a simple OO implementation. At the time, I really didn’t understand macros, but I was in a self-imposed time-crunch, so I hacked something together — my final thoughts were

suffice to say, this is kind a crazy way to make something, but it sure beats not being able to make it.

Now, after this chapter, I feel like a have a solid understanding of the various macro features, and even better, a sub-section called “Common Macro Idioms and Patterns” will improve anyone’s macros, no matter what your level. There are similar sections throughout the book.

I’m using Light Table as my IDE, not so much because it’s a great IDE (it’s not yet), but because its Instarepl is a nearly ideal way for me to explore clojure. I suspect I will outgrow it when I want to make something real, but while I am just learning, it’s perfect.

Any new clojure programmer should be making an account on 4Clojure and solving problems. I’m working my way through them now — follow other users to see their solutions to a problem after you solve it (check out the top users page for good examples, or follow me for more tortured ones)

Finally, I highly recommend Chas’s Clojure Atlas, which is $5 if you buy Clojure Programming. You really have to go see it for yourself, but essentially, it’s a clojure documentation visualization and search web app — I was skeptical at first, but I could not live without it. Mostly, I use the search, which is lightning fast, but when you don’t know what you need, the visualization is key. Every documentation balloon also has a way to just see the source, which is perfect if you are trying to see well-written clojure. And, in a very nice touch, you never have to give the search box focus, typing always starts a search.