Higher Order Blog

home

Annotated Clojure links - part 1

17 Nov 2008

RESTafarians will tell you that hypermedia is one of the essential ingredients of REST (and the web in particular), and that most people aren't taking this seriously enough. In my last posting I claimed that
I will write a number of blog postings about my experiences with Clojure. [...] However, to my knowledge, there is less information about how to actually program Clojure.
Well, my knowledge was wrong. Surprise, surprise -- I'm not the first person to discover Clojure, be excited and decide to blog about it… So instead of showing you Clojure fibonacci, (prn "hello world") and writing imprecisely about functions and macros, I'll hyper-point to to high-quality information on 'getting started with Clojure'. If nothing else, my links will increase the PageRank of those blogs ;-) So here is my RESTful description of one path to Clojure. Readers please add your high-quality Clojure links and provide a reasonable description in the blog comments.

Part I - getting started

Clojure theory

Get excited: Clojure for Java Programmers
Get excited by watching the Clojure videos. For the basics, see Clojure for Java Programmers 1 and 2, with accompanying slides. This is great quality information targeted directly at Java programmers. You should have a strong background in Java and be knowledgeable of Java concurrency (I personally recommend Java Concurrency in Practice by Brian Goetz et al.).
Re-iterate your understanding, and go deeper: comparison with other Lisps
If you are ready to dig deeper into this: Clojure for Lisp programmers 1 and 2, with accompanying slides. There is even a transcript of the audience questions for part 1.
The Clojure website
There is a lot of information on the website. To me, this information made the most sense after having seen the videos. I particularly like the essay: Values and Change which explains Clojure's functional approach to mutability and state. Furthermore, sometimes when watching the videos you'll want to clarify something. A good way to do this is reading the API docs on the site (which is quite precise) and then open up a REPL (see next step) and try it out.

A Clojure environment

In order to get Clojure up and running you need to setup a working environment containing Java 5 or 6, Clojure and some kind of IDE or text editor. I've had success with Aquamacs (which is an Emacs for Mac).
Emacs & Unix: Clojure, Emacs and Slime/Swank on Ubuntu 8.10
Slime/Swank is a development environment for Emacs. Adapting this guide to Mac and Aquamacs was easy. A couple of useful Emacs commands:
  • C-x C-e (Ctrl+x then Ctrl+e or "hold Ctrl then press x then e the release"). Send the current expression (to the left of cursor) to Slime.
  • C-c C-d C-d. Show docs for the current symbol.
  • C-c RET. Macro-expand once.
  • M-.. Goto (edit) definition of current symbol; and.
  • M-,. return from Goto (edit) definition of current symbol.
Others: Eclipse IDE, Netbeans plugin, Vim anyone?
I only have experience with the Emacs setup - it works fine so far.
If you are annoyed with Aquamacs keeping opening windows on you: (custom-set-variables '(one-buffer-one-frame-mode nil nil (aquamacs-frame-setup))) Bill Clementson is currently blogging Clojure. He has a setup posting where he is able to run JSwat Java debugger with Clojure. More detailed information about debugging with JSwat here. I plan to go into depth on various parts of Clojure in the next couple of postings. It will be the same style of annotated links, possibly with discussion if I feel I have anything interesting to say.