24 ms·
Clojure is most definitely a Lisp. The biggest difference from more traditional lisps is that it has literals for a wider variety of data structure types. Apart
by rsamvit 13y ago
Clojure is most definitely a Lisp. The biggest difference from more traditional lisps is that it has literals for a wider variety of data structure types. Apart from that, it has every single characteristic that defines a lisp.
> After proper Scheme training (CS61A) Clojure looks awkward and messy but very useful, as it supposed to be due to its "productivity beats clarity/conciseness" philosophy of scripting languages, such as Ruby.
As someone with "proper Scheme training" (CS61A), I've found that Clojure is actually much more clear than Scheme in most cases. The code is less beautiful from a purely visual perspective because there is more syntax, but a lot of complexity gets removed when you add literals for sets, vectors, and maps.
- hga 13y agoWell, I don't think it can be called a LISP, as in LISt Processing, which I pedantically use to describe the Lisps that came before it, because in addition to making those additional data structures first class syntactic citizens and their widespread use by programmers, it as dschiptsov notes modified some standard LISP syntax to use vectors where you have a list that'll never be modified, extended, etc. E.g. (defn name [arg1 arg2] body). Lists are not the alpha and omega like they are in LISPs. But I agree it has "every single characteristic that defines a lisp", even if it looks funny to experienced Lispers like myself. Aesthetically I much prefer standard LISP syntax + indentation , but 100% support the use of literals for the non-list data structures. Many disagree on the syntax, and if no longer having a sea of pure parens brings more adaptation I'm willing to live with it. I got the impression the syntax changes were due to that reason vs. inspiration from ML, but I'm not at all sure about that. Still, Rich Hickey is an experienced Lisper with exquisite taste below the level of syntax, so I'm pretty sure he was aware of the implications of his syntax changes.
- jared314 13y agoI don't understand your position on lists. In Clojure, lists, vectors, and other collections are unified under the Seq abstraction. To me, they are all the same, until I need some specific behavior or performance characteristic.
- hga 13y agoIt's aesthetic, how the code looks (e.g. in an editor), and can't be separated from a quarter century of LISP experience (Lisps where only lists/pairs are syntactically first class). Note data in code is an exception, it's perfectly fine to e.g. include literals of other collections. Don't take me wrong, making the other collections syntactically first class and unifying them under the Seq abstraction is a really good thing, in fact when I appreciated that it was the first thing that got me really excited about Clojure, especially Clojure as "the next Lisp". But personally, if just for myself, I would have kept the vectors out of the syntax and depended on indentation in smart editors.
- jcrites 13y ago> Lisps where only lists/pairs are syntactically first class There are several types of first class syntax in Lisp: http://amitp.blogspot.com/2007/04/lisp-vs-python-syntax.html http://amitp.blogspot.com/2007/04/lisp-vs-python-syntax.html
- regularfry 13y agoMy understanding is that the square-bracket notation is just a reader macro to provide syntax sugar. Now, I know Clojure doesn't expose reader macros to the end user, but you could achieve the same syntax in CL without too much hassle (http://dorophone.blogspot.co.uk/2008/03/common-lisp-reader-macros-simple.html http://dorophone.blogspot.co.uk/2008/03/common-lisp-reader-m... for something similar). I don't think it's necessarily reasonable to criticise it for baking in a choice you could quite happily make in CL. EDIT: "Criticise" is clearly the wrong word, since your description isn't perjorative. "Distinguish" would be better.
- hga 13y agoIndeed, and I'm not really criticizing it, it's a matter of taste, and arguing over that is generally fruitless. However, while I could make such a choice in CL, or modify Clojure, the standard including indentation for such a fundamental part of a language is controlling, and if I want to be part of the community I have to follow it.