clojurejvmjvm-languages

Learning Clojure coming from Lisp


I'm thinking seriously of making Clojure my new hacking language since I love Lisp but have some problems with CL and Scheme. I've never worked in the Java environment before and my lisp experience is limited to working through "SICP" and "The Little Schemer."

What do I need to know? Are there any good resources on "The Clojure way?" Any resources on Clojure style? I've found Mark Volkmann's excellent page, but the books I've looked through seem a little spare.

Also, what do I need to know about Java? I'd rather not learn Java just to learn Clojure, but I imagine I'll have to know at least a little. Also, what is the workflow like? My experience is limited to dynamic languages, so I have no idea what I'd have to do to distribute an application without source on the JVM.

I've googled this obviously, but there's a large amount of information and not very much "clojure specific" stuff.

I guess I'm looking for some sensible suggestions on the kind of literature I should read in some sort of logical sequence.


Solution

  • You can't go wrong watching as many of the Clojure videos on Blip.tv as you can handle, especially those by Rich Hickey himself. These really help drive home the conceptual points and aspects unique to Clojure.

    If you are sufficiently familiar with Lisp concepts, you may want to initially focus on learning how Clojure "maps" to the Lisps you've played with. Watch the videos by Rich Hickey on "Clojure for Lisp Programmers."

    You do need to have some familiarity with Java, because Clojure doesn't shy away from using it. It's not somehow un-Clojurey (as far as I can tell) to use Java where it's smart. I'd at least skim through the API docs for the java.lang and java.io packages, because java.lang is automatically available within your Clojure programs and java.io is used frequently.

    With my Clojure-to-Lisp dictionary in my head and my Java basics behind me, I'd pick a small project to work on. Keep the Clojure and Clojure-contrib API docs handy (either on the web or use the (doc) command from the REPL), and peruse the many, many Clojure blogs out there. Two of my favorites are http://nakkaya.com/ and http://stuartsierra.com/. If you use Diigo, a whole slew of blogs have been bookmarked to the clojure group.

    NOTE: don't get hung up on your dev environment. There are a multitude of options listed on the Getting Started wiki page. For learning Clojure and your first small projects, I'd just pick your plain text editor of choice, learn and use the basics of Leiningen to get a nice project directory setup with all your paths and dependencies taken care of, then use the command "lein repl" to startup a REPL with all of your dependencies loaded and available. In assuming you use Emacs (based on your previous Lisp experience), you can describe-variable your inferior-lisp-program to be lein repl, and just start Emacs from the root of your example project for everything to work automagically.

    There are books you can read, notably The Joy of Clojure, Programming Clojure and Practical Clojure. The latter two are more "practical" than the first, which is more "philosophical" (excuse the gross generalizations). Practical Clojure is up-to-date with Clojure 1.2, whereas Programming Clojure is a little bit older.

    Finally, get on the #clojure IRC channel and use the Clojure Google group, because there's a bunch of smart, friendly folk who enjoy helping others.