Programming Clojure Beta 6 is now available. What’s new:
- A new Chapter, “Functional Programming,” exlains recursion, TCO, laziness, memoization, and trampolining in Clojure.
- A new Section, “Creating Java Classes in Clojure,” shows how to create and compile Java classes from Clojure.
- The snake example has been moved into the concurrency chapter. The snake demonstrates how to divide your model layer into two parts: a functional model and a mutable model.
- The STM example in the introduction now uses
alterinstead ofcommute, which allowed a race condition. Given the problem domain of the example, the race condition was acceptable. However, explaining this in the introductory chapter would have been distracting. - The lancet
runoncefunction now useslockinginstead of an anagent. Yes, you can do plain old-fashioned locking in Clojure! Agents are unsuitable for the kind of coordination lancet requires, because you cannotawaitan agent while inside another agent.
While I am talking about lancet: it now has its own repository. I have added integration with clojure.contrib.shell-out, so lancet can now call either Ant tasks or other applications. It is still far from being a replacement from Ant or Rake, but maybe your contributions can change that!
The book is now prose-complete, so if you have been waiting for the whole story, this is it. A number of readers have made suggestions for additional topics. If you have suggestions, please add them as comments to this post. For reasons of space and time, most new topics will appear in a series of articles on this blog, not in the book itself.
Clojure and clojure-contrib continue to evolve. To make sure you have the latest, greatest version of the sample code from the book, go and grab the github repo.
Thanks again to everyone who has been offering feedback. I have cleared almost 400 entries from the errata/suggestion page. Keep the feedback coming!
Comments
My comments are not related to your new book, as I have not read it yet. I will.
I’m curious at what point in your career did you re-discover LISP? I,like most old school programmers, used lisp to customize emacs, but never groked it. It always looked ugly, maybe even alien. I have started to appreciate LISP’s power only after being a professional developer for well over 15 years now. I had to write some college projects in LISP, because it was required in my AI class. I still remember writing those AI projects and thinking “this would be so much easier to do in C”. I of course never understood at the time what the profs were trying to convey. Based on your publications and conference speaking, I know you are well versed in OO paradigms. It has taken at least the last decade to push the OO concepts into the commercial mainstream. I’m a firm believer in OO over structured procedural techniques. However, I also realize that other paradigms can be very useful depending on the problem at hand. Do you think that Clojure has the possibility to push LISP into the mainstream?