views:

654

answers:

11

I ultimately want to learn Clojure, but I've found learning resources for Clojure to be scarce for people of little experience...

I'm wondering if it would be beneficial to start with Scheme (read The Little Schemer and SICP) or some other Lisp variant.

My only other programming experience is with Java and Python (which is pretty minimal). I ultimately want to study Clojure in my off time since I find it fascinating and my college classes use Java.

Any suggestions appreciated, Thanks.

+5  A: 

I started with the book Practical Common Lisp, and use Emacs & SLIME with Steel Bank Common Lisp.

Demosthenex
In case you decide to start with PCL, you may be interested in S. Halloway's exercise in porting all the programming exercises to Clojure: http://blog.thinkrelevance.com/2008/9/16/pcl-clojure
Carl Smotricz
I have an irrational allergy to all things Java. I'll stick to SBCL, though I've been considering ECL so I can make standalone executables.
Demosthenex
+1  A: 

Learning something new is almost always good. And if you only know Java and Python, then learning a functional programming language will stretch your mind.

Scheme is among the simplest of LISP variants, and it's well-documented. Go for it!

Chip Uni
+8  A: 

I'd go with Scheme. It's simple, minimalistic, extremely consistent and it could be argued that it's more functional than LISP (which is nice if you want to learn a new paradigm). I've also found Scheme IDEs much more user-friendly than LISP's (PLT Scheme is a good one).

In addition, there are plenty of excellent resources on either Common Lisp or Scheme, so that shouldn't be the deciding point.

Max Shawabkeh
I found CL looks ugly after I learnt Scheme :)
leppie
+11  A: 

Stuart Halloway's book is an excellent resource if you're just starting out. There are couple new books in the works that are available for download in an early form (Joy of Clojure, Clojure in Action, etc.).

Also I highly recommend the mailing list as well as the irc channel. Especially the irc channel, there's a lot of helpful people there and questions are usually answered pretty quickly.

While learning Scheme is certainly helpful (now that I've played around with Clojure for a year) I would also say that's unnecessary for learning and having fun with Clojure.

dnolen
Thanks I'll keep that in mind, might go for scheme first just to try an get a good grasp on FP
defn
@defn, if you go with Scheme I suggest SICP. Remember that Scheme isn't very strict about FP so unless you look at a Scheme text with that in mind, that won't help your Clojure. Unfortunately SICP is long (tho fun), so it's very roundabout.If you want to get a faster grasp on FP check out the following:http://www.cs.chalmers.se/~rjmh/Papers/whyfp.htmlI've also been looking into Haskell. Rich Hickey has a taken a lot of great ideas from there, so I whole heartedly recommend this as well: http://learnyouahaskell.com/
dnolen
Matt Curtis
Another voice agreeing just dive in. Programming Clojure + the IRC channel can get you going, with how helpful everyone is. Once you have the basics, Joy of Clojure looks very promising to get a deep dive of how to REALLY use the language.
Runevault
+5  A: 

Common Lisp using Practical Common Lisp.

didi
In case you decide to start with PCL, you may be interested in S. Halloway's exercise in porting all the programming exercises to Clojure: http://blog.thinkrelevance.com/2008/9/16/pcl-clojure
Carl Smotricz
+3  A: 

I suggest that you start with Scheme and then move on to Common Lisp, as Scheme is simpler. As you are new to Lisp, a good starting point will be Teach yourself Scheme in Fixnum Days by Dorai Sitaram. Once you are comfortable with the basics of the language, you can start working with SICP.

For Common Lisp, you can follow a similar path: start with a simple tutorial based approach, become comfortable writing small programs then read a book that will teach you advanced concepts. I suggest the following books to learn Common Lisp. Take care to read them in the given order: COMMON LISP: An Interactive Approach (Stuart C. Shapiro), Successful Lisp (David B. Lamkins), Practical Common Lisp (Peter Seibel) and On Lisp (Paul Graham).

Paul Graham has also written ANSI Common Lisp, which is a good reference.

Vijay Mathew
A: 

There really only are two common variants, Scheme and Common Lisp. They are very similar, both have a variety of implementations, and switching between the two is easy enough. If you want to write an application, I would suggest CL because of the superior libraries. If you want to learn FP style, go with Scheme.

In addition to the books mentioned here, I also suggest "Paradigms of Artificial Intelligence Programming: Case Studies in Common Lisp" by Peter Norvig.

Dietrich Epp
A: 

I would go with LFE, the speed you learn is proportional to the amount of bugs you experience. Choosing LFE will give you both Erlang and Lisp at the same time.

Flinkman
Don't know about other people, but it wasn't immediately obvious to me that LFE is Lisp Flavored Erlang: http://metajack.im/2009/01/09/lisp-flavored-erlang/
Carl Smotricz
Thanks, you are right.
Flinkman
+5  A: 

I second dnolen's recommendation of grabbing S. Halloway's book (I bought it, and it's great) and learning Clojure right off the bat.

I worked my way (partly) through SICP a while back and really struggled. I found Clojure pleasantly simple after that, possibly because I'd already had a bit of experience with Scheme. Still, especially for someone who's already familiar with Java, I'd say it's cool to jump right into Clojure. Rationale:

  • You have convenient access to the entire Java API and the entire body of libraries written for Java; for example, I recently built a Swing GUI for/from a Clojure program, and used the Apache HTTP components to do some Web wrangling.
  • Clojure tries to be less "lispy" than other Lisps: Cases in point are:
    • reduction of "unnecessary" parentheses: e.g.
      (cond (condition) (value) (condition) (value)) rather than
      (cond ((condition) (value)) ((condition) (value)))
    • use of something other than parentheses in a few meaningful places; e.g. argument lists and bindings for let and loop, etc. are in [square brackets] rather than (parentheses). Makes function definitions easier to read IMHO.
    • the list is not the only data structure. There are well integrated
      • [vectors] (random accessible like arrays) and
      • {hashmaps};
        These make life easier, especially if you're used to having them in Java.
  • The function for defining functions is (defn). You of all people should appreciate that ;)

A recommend-worthy first tutorial is Moxley Stratton's Clojure Tutorial. There's also a huge SO discussion on Clojure tutorials that yields up a lot of links.

Something I found enormously helpful with my first steps in Clojure was the Clojure Cheat Sheet. This addresses the common case where you know roughly what you want to do, but not which function to use. One would wish other languages would adopt this concept. Having found a likely function for your need, you can get more documentation on it using (doc <name>) in a Clojure REPL.

Your mileage may vary, of course; but by the time Amazon delivered Programming Clojure I had already learned enough Clojure from the Web that the book was more a source of "the big picture" than a tutorial for me. But certainly one could do a lot worse than learn Clojure programming from that book.


Possibly it's apparent from the above that I'm enthusiastic about Clojure. I find it refreshingly different after years of Java, and powerful enough to accomplish whatever itches me. I even donated to the project :)

At the risk of regretting this later, I also offer (free) beginning Clojure assistance and tutoring via email, Google Chat or Wave. My mail address should be pretty easy to guess.

Carl Smotricz
It's also relevant to note that Chris Houser and Fogus are writing a book that specifically addresses the problem people have with 'thinking in Clojure'. It's available via Manning Early Access Preview right now, and will be released sometime this fall.
Rayne
A: 

For the visual/audo learners i highly recomend Righ Hicky's video series on blip.tv
Clojure for java programmers and then just hit the REPL. The rest of the series follows naturally and can really get the creative juices flowing. PCL (Practical Common Lisp) is an exciting book though some of it is not really applicable to clojure. I highly recommend the chapter on Macros.

Arthur Ulfeldt
+1  A: 

I was in your position, and split my attention between Scheme and Common Lisp. Looking back now I think that (for the purposes of learning Clojure, as opposed to personal development) I would've been better off focusing on Common Lisp, with Practical Common Lisp and PG's On Lisp. Now that there are actual books focusing on Clojure, you should definitely go with one of those.

Nathan Hughes