10 ms·
Clojure is a nice choice if you're looking to write production code, especially if you're already using other JVM languages (Java/Scala/JRuby/etc.) However, Cl
by chimeracoder 14y ago
Clojure is a nice choice if you're looking to write production code, especially if you're already using other JVM languages (Java/Scala/JRuby/etc.)
However, Clojure strays from a number of standard common idioms in other Lisps, which, IMHO, makes Clojure a less-than-ideal candidate if you're looking to get the "full SICP" experience. It has a lot of other benefits as a language, but for a learning experience, you'll miss out on some of the idioms common to other Lisps.
But, give it a shot and see if it works for you. Once you've learned one, it's really to learn another dialect.
And, in the end, the only wrong answer to 'Which Lisp?' is the empty list[0]. :)
[0] This is an example of a super-nerdy Lisp joke which works in Common Lisp but not Clojure - in Common Lisp, 'nil', 'false', and the empty list are all the same value, (and all other values are considered "truthy"). In Clojure, they are three distinct entities, and there is a discrete "true" value.
- kyllo 14y agoThe joke "My other car is a cdr" also works in Common Lisp and Scheme but not Clojure.
- chimeracoder 14y agoWait, this one is news to me. How does Clojure break this? It still supports car/cdr, if I recall correctly, right?
- Xurinos 14y agoThe closest Clojure has to car/cdr is first/rest. It supports "cons" but only for creating sequences. Traditional Lisp car/cdr is one-location/other-location, and its cons puts together pairs of data. Often this is used for constructing sequences, but it is also often used for trees. Clojure: user=> (cons 3 4) IllegalArgumentException Don't know how to create ISeq from: java.lang.Long clojure.lang.RT.seqFrom (RT.java:494) user=> (cons 3 '(4)) (3 4) Common Lisp: CL-USER(1): (cons 3 4) (3 . 4) CL-USER(2): (cons 3 '(4)) (3 4) CL-USER(3):
- kyllo 14y agoYeah those error messages completely baffled me for the first few hours I spent in the Clojure REPL. It was strange enough to not have car/cdr and cons for working with tuples, but then I wrote a simple recursive algorithm and got a java.lang.StackOverflowError. I now understand why and the alternative idioms that Clojure provides, but at the time it was a WTF moment.
- omaranto 14y agothey are called first and rest in clojure, not car and CDR.