4

I've been reading Structure and Interpretation of Computer Programs. Lisp is teaching me to think in its way. As a java developer, I wish to learn clojure.

I know clojure is similar to lisp. So my question is, does learning Lisp help me learn clojure easily? Are there similar concepts in both languages?

Matt Fenwick
  • 48,199
  • 22
  • 128
  • 192
batman
  • 4,728
  • 8
  • 39
  • 45
  • 2
    [see this SO question](http://stackoverflow.com/questions/11243936/does-learning-one-lisp-help-in-learning-the-other) – Kyle Aug 20 '12 at 13:27

4 Answers4

6

Clojure share many similarities with other Lisps. SICP is a great book and although it focuses on Scheme a lot of what it teaches you will be directly relevant to Clojure.

If you lean one Lisp then it will be substantially easier to pick up another.

There are however a couple of things about Clojure that make it "different" that are worth noting:

  • It extends classic Lisp syntax with vectors [], hashmaps {} and sets #{} as well as the traditional lists ().
  • It is more of a functional programming language in style than most other Lisps - pretty much everything is immutable, sequences are lazy by default etc. In some ways Clojure feels quite strongly influenced by Haskell
  • Clojure embraces the Java platform in a big way - it runs on the JVM you can easily use Java libraries directly. As a result, although you don't strictly need to know Java to be effective in Clojure it helps to have an understanding of the Java ecosystem and tools.
  • The Clojure STM system / support for concurrency is very innovative and different. Worth watching this video: http://www.infoq.com/presentations/Value-Identity-State-Rich-Hickey
mikera
  • 105,238
  • 25
  • 256
  • 415
5

Take this with a grain of salt; I'm a Common Lisper with some Scheme experience who's just getting started on Clojure, so I'm by no means an expert yet. You may want to google others' experiences.

It looks like the differences between Clojure and CL/Scheme are mostly in the minute details. The overarching principles are more or less the same, and it doesn't seem like learning Clojure will significantly change how you think about programming, assuming you already know one of the other Lisps. There's a much greater emphasis on immutability and functional programming than you find even in Scheme, and a few functions are named differently, and you need to balance parens/brackets/curlies rather than just parens, but that's pretty much it at the language level.

Having learned CL/Scheme, it seems that I'm having a much easier time of Clojure so far than I otherwise might.

As a final thought, working through SICP and the accompanying lectures is worth your time even if you plan to never look at Scheme again. It teaches a lot of generally useful CompSci principles, and a particular way of thinking that'll help you as a developer with whatever language you end up using.

Inaimathi
  • 13,853
  • 9
  • 49
  • 93
3

Each language has its own set of nuances. You are currently learning Lisp's little quirks (assuming Common Lisp/CL), but pick up another language, let alone a second Lisp dialect, and you'll learn those quirks/differences/nuances, too.

Unless you have loads of time to learn, I would learn Clojure if you are interested in programming in it, Lisp if you are interested in programming in that.

Learning Lisp isn't a bad thing, because you'll get used to learning how Lisp dialects differ from Algol-C based languages. For that matter, the same argument could be made about learning Scheme.

Until Clojure, I programmed in similar languages, but even Bliss-32 and PL/I IMHO are more similar to C and Java then they are the Lisp dialects. Learning Clojure required on my part -- and is still requiring -- an even greater mental realignment than going from C to C++ (in the 90s).

I enjoy the realignment, but it is gradual, with a learning curve.

octopusgrabbus
  • 10,555
  • 15
  • 68
  • 131
2

I went down the same path, since a friend of mine was an old Lisper made me learn Lisp out of interest. He started hacking back in the early 70's, and worked for some of the Lisp companies. Whenever we were talking about programming languages, he'd refer to concepts found in Lisp, and I felt I never quite got what he ment.

Learning Lisp was a great start into Clojure for me, and I ended up with Clojure since I was looking for a Lisp capable of running on ARM CPUs. In my eyes, Lisp is less complex, since it's not integrated with the Java VM, and without knowing Java well it would much more difficult to understand Clojure than Lisp. I can only say, having a good basic understanding of Lisp definitely helped me when learning Clojure.

raju-bitter
  • 8,906
  • 4
  • 42
  • 53