Byzantine Reality

Searching for Byzantine failures in the world around us

Programming Clojure, Beta

Clojure, Clojure, Clojure! All the time now I’m writing about this funny weird programming language with the interesting name! It’s a bit different than your run-of-the-mill language, both to it’s credit and against it, but shows promise thus far. So you bet that the minute the beta for Programming Clojure came out I picked it up. With that in mind, let’s see how it fares.

Let’s begin by saying that this will not be the big Clojure v. Ruby v. Java post I had hoped for, since I don’t yet have enough Clojure experience to really rattle off about it in the way we did earlier with Ruby v. Java. That may be better since it gives us a better look at the book itself rather than the language.

So the book is a “Beta Book”, which essentially is the book form of episodic gaming. You get the book way before it comes out to the general public but it’s got errors and stuff missing and your input has some impact on how the whole thing turns out. At the moment the book is about half done, which is fine for satiating my Clojure interest that has possessed me over the last few weeks, and the errors are relatively minor (and the errata covers it pretty well). With that in mind, append the words “thus far” to the end of every sentence, since this presumably could (but likely won’t) change radically once the book is released.

The main reason I’m into Clojure is their approach to solving the concurrency problem: software transactional memory. My first exposure to STM was Haskell, but for some reason it just didn’t really catch on for me. So here’s round two with Clojure! The chapter in the book about this is relatively well fleshed out but not all the code examples are there yet, so I’m delaying my verdict on STM for later. But the book does a good job of touring Clojure’s STM thus far and hopefully it only gets better.

The book also does a good job of showing you every alterative you have of doing a particular task and then telling you which way is the Clojure way. That was particularly useful to me since in Clojure, there seems to be a billion ways to do anything you feel like (syntactically and sematically). The examples are also pretty straightforward and get the point across well enough.

The big thing I got excited about when I saw the table of contents was the Monte Carlo simulation for approximating pi, which was a bit of a downer when I later learned that that chapter wasn’t ready yet. It was a double downer when I got to the Concurrency chapter and it’s talking about running the simulation, for which we don’t have the code for. But again, that’s a “thus far” thing. That will be addressed and will go away with new releases of the book, and it’s cool to see it in the first place.

It’s my first beta book, and I can say I like it. The only thing I could possibly recommend would be some sort of diff-like mechanism that accompanies the beta books, since when I got the Beta 2 release, I had no idea what had changed since Beta 1 and just skimmed the whole thing to see what was changed. The big changes are obvious (e.g., new chapters or subsections) but the little changes (e.g., technical errors) were things I was only aware of by following the Clojure Google Group.

So I’ll keep fiddling with Clojure and hopefully in a little while we’ll have a fun comparison to whine on about. Since that’ll be a little while, I’ll try to talk non-Clojure in the meanwhile and balance things out.