Clojure for dummies: a kata

Reference: Clojure for dummies: a kata

It's good to see someone trying Clojure and sharing his experiences. Congratulations are due for getting it up and running and finishing a kata.

Giorgio Sironi:

Clojure is a LISP dialect; if you have ever been forced to use LISP in a computer science class, I understand your resistance towards this class of totally functional languages.

I appreciate his honesty here. Universities have traditionally used Lisp to teach functional programming. They often neglect to mention that mosts Lisps are not purely functional. In fact, they lie to the students in the name of pedagogy. People leave Programming Languages class with many false notions about Lisp.

In fact, LISP for many of us means lots of Reverse Polish Notation where (+ 1 2) evaluates to three; absence of for cycles [loops] and other commodities to privilege tail recursion; and absolute lack of state in the form of variables (the state isn't really absent: I've seen it on the stack.)

In Reverse Polish notation, the same expression would be (2 1 +). Lisp uses Polish notation, otherwise known as Prefix notation.

Common Lisp, in fact, has more loops than Java. Java has for, while, and the sadder do..while loops. Common Lisp's loop macro alone trumps any other language I know for imperative and stateful iteration. In addition to loop, Common Lisp defines dotimes, dolist, do, do* (a variation on do), and the loops for symbols in a package do-symbols, do-external-symbols, and do-all-symbols.

The fact that a non-lisper believes s omething about Lisp so false yet so common hints that something is very wrong. The misconception "absolute lack of state in the form of variables" will be familiar to many Lisp programmers who talk to non-lispers.

Download and unzip the last release of Clojure. Start up a class by specifying clojure-1.3.0.jar in the classpath :

    java -cp clojure-1.3.0.jar clojure.main

It's nice that Clojure is so easy to run.

Again, thumbs up to Giorgio for finishing a kata in a new language. Keep up with the Clojure!