views:

693

answers:

7

I am a lifelong object-oriented programmer. My job is primarily java development, but I have experience in a number of languages. Ruby gave me my first real taste of functional programming. I loved the features Ruby borrowed from the functional paradigm such as closures and continuations. Eventually, I graduated to Scala. This has been a great way to gradually learn to approach non-trivial problems in a functional manner.

Now I am interested in Clojure. I know all the sexy features that make it enticing (software transactional memory, macros, etc.), but I just can't get used to "thinking in lisp". I've seen Rich Hickey's screencasts aimed at java programmers, but they are geared towards explaining language features and not approaching real world problems.

I am looking for any advice or resources which have made this transition easier for others.

+3  A: 
Norman Ramsey
+4  A: 

Going right to Clojure from OOP, I'd only recommend the excellent Programming Clojure by Stuart Halloway.

I love it, and it does a great job of covering a lot of Clojure and a fair bit of funcational programming in the process.

The Little Schemer and SICP are great, but they're not so relevant for Clojure, if that is what you want to learn.

Isaac Hodes
+1. Halloway's book struck the perfect blend of introduction and practicality for my tastes. I hate Lisps for the most part, but like Clojure mostly as a result of Programming Clojure.
JUST MY correct OPINION
+2  A: 

I really like Brian Twill's series of Clojure videos on youtube as a painless introduction to some of clojure's ideas. They don't assume any great knowledge of Lisp or functional programming languages.

As far as books go, I agree with Isaac that Programming Clojure is an excellent resource. You might also consider some forthcoming books on clojure:

The Joy of Clojure

Clojure in Action

Both have early access available online if you buy now. Also I think both have discounts available -- try looking on clojure.org.

The Lisp books that Peter and Norman mention are probably good choices (I like SICP, but haven't read the others). But the differences in syntax with Clojure might get a bit frustrating if you're just starting out. For that reason I recommend starting with Clojure-specific books at the beginning.

(Edited to fix link.)

Rob Lachlan
+8  A: 

My first introduction to Lisp was: Paradigms of Artificial Intelligence Programming of Peter Norvig. It is a very readable and gentle introduction to many features of Common Lisp and functional programming concepts.

Starting directly with some Clojure books could be preferable for you, because there are several differences between Common Lisp and Clojure which may become confusing if you're trying to learn both at the same time.

At the same time, try to get hands on experience messing with the Clojure REPL, doing some exercises like Project Euler which you then can contrast with other Clojure and imperative Java solutions.

Furthermore, if you have any questions on Clojure programming and idiomatic style, do not hesitate to discuss your code with other Clojurians. There are several options to do this, such as: Clojure on Google Groups, the #clojure IRC channel on Freenode, Twitter via hashtag #clojure, and of course here on Stackoverflow!

Michiel Borkent
+1 for the project Euler recommendation - simple little problems but great for learning the basic language constructs
mikera
+2  A: 

All the answers so far are great. I would add:

  • Purely Functional Retrogames is an excellent series on how to design old school video games in a functional, side effect free manner. If you go through this and grasp how to write Pac-Man without side effects, then you will have gone a long way to inducing the mindset necessary to solve many/most other problems functionally.
  • Halloway's Programming Clojure is the best general introduction to Clojure, and gives some idea of how to think about problems in a functional rather than object-oriented way, particularly the snake game example.
  • Seibel's Practical Common Lisp is an excellent practical guide to solving real-world problems functionally, such as building a database. Though written for CL rather than Clojure, which allows mutable data, the concepts carry over without much modification, and the full text is available online for free from the author's website. Worth at least a glance.
Paul Legato
Stuart Halloway (author of Programming Clojure) is translating many of the code examples from Practical Common Lisp into Clojure - see http://thinkrelevance.com/blog/2008/09/16/pcl-clojure
Dave Kirby
+3  A: 

I'd recommend getting the MEAP version of The Joy of Clojure. I have it, and right now the MEAP offers a total of 12 chapters. So far, it's by far the best book I've ever read on a programming language. Those 12 chapter are plenty to get you started with Clojure, all the way up to some advanced topics. The current MEAP (which gets updates with new chapters quite frequently) combined with the ociweb Clojure tutorial, stackoverflow.com, and the #clojure IRC channel on freenode, I think you'll be fine.

While I agree that Programming Clojure is a great introduction to Clojure, and does a very good job, we can't deny the fact that it gets more and more outdated every week. You have to keep in mind that Programming Clojure was written for Clojure 1.0. Right now, we are fast approaching the release of Clojure 1.2. For example, with the inclusion of defrecord, structs are going to be obsolete.

Rayne
I, too, have the MEAP of "The Joy of Clojure". I am about 200 pages in and really enjoying it.
Ralph
yes, it's informative
Gary
A: 

If you're looking for an introduction to "Lispy thinking", I'd recommend [Practical Common Lisp][1]. It's a good read and IMHO perfect for seasoned programmers coming from a non-lisp background.

The downside is that it targets Common Lisp, not Clojure; the main reason being that Clojure is much more functional in its approach. You'll probably want a Clojure specific book too.

[1]: http://www.gigamonkeys.com/book/ - full text online.

Joost Diepenmaat