Getting started with Clojure

285 views
Skip to first unread message

Robin Bhattacharyya

unread,
Jan 13, 2008, 6:06:24 PM1/13/08
to clo...@googlegroups.com
When I was trying to figure out how Clojure differs from Common Lisp,
I walked through Chapter 3 of Practical Common Lisp and re-implemented
things in Clojure. The simple database example touched on many topics
like fn, vectors, maps, refs, sync, recur, macros, formatted printing,
writing and reading from files.

I attached the file here because maybe it will help someone compare
Clojure and CL side by side.

Robin

practical_clojure.clj

Rich Hickey

unread,
Jan 13, 2008, 7:13:02 PM1/13/08
to Clojure
Very neat - thanks! Any impressions after this exercise?

Rich

Robin

unread,
Jan 13, 2008, 8:00:24 PM1/13/08
to Clojure

>
> Very neat - thanks! Any impressions after this exercise?

--Clojure syntax is nice: being a lisp-1 the syntax is simplified.
--Maps are functions of their keys, and keys are functions of maps is
very elegant.
--The auto gensyms are great, but I did not use them since the source
used variable capture.
--In the macros, '~' is definitely more readable than ',' for
expansion.
--Preventing cd from expanding to user/cd in a macro was a little
tricky: `(fn [~'cd] (and ~@(make-comparisons-list clauses))))
--Commas as whitespace is a nice option.
--The Java integration is pretty seamless and makes it possible to
leverage any Java lib.
--More lispy formatted printing options would be nice.
--A method for doing keyword args would be nice.

If you are on the JVM, then Clojure is a breath of fresh air. :)

Thanks for sharing Clojure with the world,

Robin
Reply all
Reply to author
Forward
0 new messages