Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does learning another dialect of lisp make it easier to learn clojure?

Tags:

clojure

lisp

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?

like image 936
batman Avatar asked Dec 05 '22 14:12

batman


2 Answers

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
like image 73
mikera Avatar answered May 03 '23 16:05

mikera


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.

like image 31
Inaimathi Avatar answered May 03 '23 17:05

Inaimathi