7 ms·
Oh, but you're wrong I believe. In Clojure, as well as in most other lisps, this: '(1 2 3) constructs a value of type list, while this: [1 2 3] constructs a
by klibertp 12y ago
Oh, but you're wrong I believe. In Clojure, as well as in most other lisps, this:
'(1 2 3)
constructs a value of type list, while this:
[1 2 3]
constructs a value of type vector.
They are not the same and you cannot say that one somehow becomes the other. And from what I remember Clojure does have a list data-type and it still needs to be quoted, except for empty list literal, (), which is self-evaluating.
So, in Clojure you need to quote your lists, exactly like in many other Lisps, and you have literals for other data structures, exactly like in many other Lisps ([] in Elisp, #() in Racket, CL covered by lispm). But of course Clojure is so much more readable because it has so few parentheses in comparison... to Java, I suppose.
- brudgers 12y agoFor what it's worth, using quoted lists is not considered idiomatic in Clojure (so be forewarned it might get you voted off the island). Also (let [my-list '(1 2 3) my-vec [1 2 3] (= my-list my-vec)) returns `true`. It's one of the subtleties of Clojure and its implementation on top of Java's object and type systems, and one which can be difficult to parse out at the lower end of the learning curve...which is where I am.
- klibertp 12y agoBut that's besides the point I tried to make, which is that pretty much ALL Lisps include more syntax than just pure s-exps. You may like one version better than other, but saying that Clojure is the only Lisp with "revised syntax" or "syntax designed for readability" is silly. Clojure is a member of Lisp family and it's a formidable and worthy member at that. But it's not as ground-breaking or unique as some people would like to think - the family is vast and multi-generational and many things were already tried in some form or the other. I still like Clojure's particular view on Lispiness, though.
- brudgers 12y agosilly Finding a rationale for calling other people silly seems more like the point you were trying to make. To the point of attributing statements and beliefs to me that I neither stated nor indicated I held.
- klibertp 12y agoSorry if it looked like that, I didn't mean it as directed to you personally, it was more to jeremiep above and even more to the Clojure community at large, where it's easy to encounter such views.
- brudgers 12y agoSorry if it looked like that looks kind of like an apology, but isn't. The opening line of the first paragraph of your comment directly referred to the content of my post and the last word in that paragraph was silly. Now understand I'm in my 20th year of internet use, so it's not the most uncivil thing that's ever been said to me. It's not even close to a rather mild incivility that I might have written a few years ago. But it is uncivil and out of keeping with HN's community standards. There are plenty of other places that not only accept but tacitly encourage posts with that rhetorical flavor. But that's not HN. https://news.ycombinator.com/item?id=7253493 https://news.ycombinator.com/item?id=7253493
- lispm 12y ago(let [my-list '(1 2 3) my-vec [1 2 3] (= my-list my-vec)) That syntax is wrong. It lacks a closing ].