(Note that a whole lot of learning material assumes you're coming from a Java background ... which I'm not (in fact, I learned MACLISP before C and never had a chance to go beyond C++ to C# or Java).)
And there are a bunch of videos, Rich Hickey does them well; note that
most of the quotes below are from someone else that I then cut and pasted
into my TODO file for future reference:
Part 1 of a presentation by Rich Hickey to the NYC Java Study Group. A
gentle introduction to Clojure, part 1 focuses on reader syntax, core
data structures, code-as-data, evaluation, special operators,
functions, macros and sequences. No prior exposure to Lisp is
presumed.
A presentation by Rich Hickey to the Western Mass. Developers Group on
Clojure and concurrency. Brief overview of Clojure, discussion of
concurrency issues, locking, and immutabiity. In-depth look at
Clojure's refs, transactions and agents. Demonstration and review of
code for a multithreaded ant colony simulation.
An informal introductory talk/screencast covering Clojure's sequences
by Rich Hickey, the author of Clojure. Covers the motivation behind
sequences, their relationship to cons, iterators/enumerators and
collections, the sequence library, and laziness.
Part 1 of an informal introductory talk/screencast covering Clojure's
data structures by Rich Hickey, the author of Clojure. Covers numbers,
symbols, keywords, lists, vectors and maps.
Clojure is a particularly interesting functional language for a python programmer IMO. It shares a number of asthetic and cultural properties with python that other lisps and other functional languages don't provide.
Syntactically they are approximately distantish cousins. Clojure's syntax is much more restricted that pythons (obviously ;) but more prominent than other the other big lisps. Of note there is literal support for Vectors (much closer to pythons lists than the functional singly linked list), Maps, Sets, and these are used in the special forms too. A comparison (lets use identical implementations of factorial - taking some liberties so that the code is actually semantically identical, There are more idiomatic versions down the thread)
def fac(n):
"A function to calculate factorial in python"
return reduce(lambda x, y: x * y, range(1, n + 1))
(defn fac
"A function to calculate factorial in clojure"
[n]
(reduce #(* %1 %2) (range 1 (+ n 1)))
In particular there is the vector in the form ([n]) used for the arguments list. The other thing to comment on is the funny looking #(* %1 %2) bit, thats an anonymous function/expression. There are two ways to write functions in clojure, that way and using a fn form. That same expression would look like
(fn [x y] (* x y))
Clearly this becomes a matter of readability in most cases. Like python it means you have two ways to express a function. In this case you could actually just drop * in instead of the lambda, because it is just a symbol referencing a function like any other name. Python would require importing the operators library to do the same thing.
Both languages are quite opinionated about the right way to do things. You are probably familiar with pythons. Clojure has a strong philosophy behind it, but its still pragmatic. Clojure promotes pure functional programming wherever its possible, and provides an excellent range of tools to break out of that where needed.
Like Python, Clojure has good package management, good core data structures, lazy sequences (much stronger than pythons generators), quite a few batteries included (in particular if you consider clojure.contrib) though not as many as python.
So if there are so many similarities, why would you switch? A number of reasons have made me do more and more of my development in python rather than clojure.
First up i want to do more functional programming. Like many long time python programmers i started using functools and itertools, generators etc more and more, but functional style is not encouraged by certain parts of the community.
Secondly, concurrency. I've written a bit of concurrent code in python (usually in an actor style using the queue objects) but python is ill suited to this, Clojure's persistent datastructures are much stronger here. In addition there is no GIL so concurrent code is able to run fast, not just asynchronously. On top of this, clojures references types provide _many_ options for concurrency which often simplify your design considerably compared to writing a message passing thing in python.
Packaging and deployment is much better. If you are using a unix system http://github.com/technomancy/leiningen is a must get. This is a build tool that manages dependancies for you automatically. It integrates with the clojars.org repository. This pairing replaces pip/easy_install and the cheeseshop as well as tools like virtualenv.
The community is great.
If you want to get started, the following comment by hga might serve you well http://news.ycombinator.com/item?id=1033503 Rich Hickey's various presentations and lectures make a compelling case for the language, and teach you a lot about how to use it at the same time. Even if you never end up writing code in clojure, these videos will teach you a huge amount, i highly recommend them.
As you can probably tell from the amount of blather here, clojure has impressed me, and i would recommend any python programmer who has become interested in functional stuff check it out.
Here's a very quick dump of some things waiting to be read/digested/whatever in my Firefox tabs and other notes:
Learning Clojure:
The best concise intro I've come across: http://en.wikibooks.org/wiki/Learning_Clojure
You can't go wrong starting with the introductory stuff on the site: http://clojure.org/rationale
This looks like a good longer intro, but I haven't more than glanced at it: http://java.ociweb.com/mark/clojure/article.html
A longer Wikibook: http://en.wikibooks.org/wiki/Clojure_Programming
Monad tutorial (site currently broken): http://onclojure.com/2009/03/05/a-monad-tutorial-for-clojure...
And there's one Clojure v 1.0 book out, only $20 for the ebook version: http://www.pragprog.com/titles/shcloj/programming-clojure
(Note that a whole lot of learning material assumes you're coming from a Java background ... which I'm not (in fact, I learned MACLISP before C and never had a chance to go beyond C++ to C# or Java).)
Setting up your EMACS Clojure development environment (VIM and various IDEs are also supported): http://incanter-blog.org/2009/12/20/getting-started/ and http://lisp-book.org/contents/ch18.html
And there are a bunch of videos, Rich Hickey does them well; note that most of the quotes below are from someone else that I then cut and pasted into my TODO file for future reference:
Clojure for Lisp Programmers Part 1 of 2: http://blip.tv/file/1313398
Part 1 of a presentation by Rich Hickey at the Boston Lisp meeting. A fairly extensive introduction to Clojure, with a presumption of prior knowledge of Lisp. Transcript available at: http://clojure.googlegroups.com/web/clojure-for-lispers-tran...
Clojure for Java Programmers - 1 of 2: http://blip.tv/file/982823
Part 1 of a presentation by Rich Hickey to the NYC Java Study Group. A gentle introduction to Clojure, part 1 focuses on reader syntax, core data structures, code-as-data, evaluation, special operators, functions, macros and sequences. No prior exposure to Lisp is presumed.
Persistent Data Structures and Managed References: http://www.infoq.com/presentations/Value-Identity-State-Rich... (very good).
Clojure Concurrency: http://blip.tv/file/812787
A presentation by Rich Hickey to the Western Mass. Developers Group on Clojure and concurrency. Brief overview of Clojure, discussion of concurrency issues, locking, and immutabiity. In-depth look at Clojure's refs, transactions and agents. Demonstration and review of code for a multithreaded ant colony simulation.
Clojure Sequences: http://blip.tv/file/734409
An informal introductory talk/screencast covering Clojure's sequences by Rich Hickey, the author of Clojure. Covers the motivation behind sequences, their relationship to cons, iterators/enumerators and collections, the sequence library, and laziness.
Clojure Data Structures - Part 1: http://blip.tv/file/707974
Part 1 of an informal introductory talk/screencast covering Clojure's data structures by Rich Hickey, the author of Clojure. Covers numbers, symbols, keywords, lists, vectors and maps.
At the 2008 JVM Language Summit he gave a talk, at the 2009 a keynote, "Are We There Yet?": http://www.infoq.com/presentations/Are-We-There-Yet-Rich-Hic...
Check Infoq for other items as well.
The Full Disclojure videos have helped [ the author if this note ] understand some of the features new to clojure in 1.1: http://www.vimeo.com/channels/fulldisclojure