r/programming • u/iamkeyur • Mar 02 '20
Clojure: A Lisp that wants to spread
https://simongray.github.io/essays/spread.html-1
u/the_evergrowing_fool Mar 02 '20
Is not even a Lisp. And it's evangelists are annoying.
8
u/ethelward Mar 02 '20
Is not even a Lisp
Why is that? (actual question, not rhetorical)
11
u/SimonGray Mar 02 '20
A few Common Lisp developers consider anything that's not Common Lisp as "not a Lisp". There's really no good reason other than certain implementation details. One of the nice things about the Clojure community is that it's not as... unwelcoming as the Common Lisp community can sometimes feel.
2
u/lispm Mar 04 '20 edited Mar 04 '20
You are not telling the truth. There are a whole range of Lisp dialects which are considered to be Lisps, not just Common Lisp.
I find it very unwelcoming that you are dismissing people as unwelcoming, which simply have a different idea what the language Lisp is about.
Already the title of your article was spreading negativity: Clojure as a Lisp that wants to spread, whereas other languages don't? It's you who is not 'nice'.
As such you article was spreading negativity trying to evangelize Clojure - at the cost of Lisp.
0
Mar 02 '20
[deleted]
14
u/pron98 Mar 02 '20 edited Mar 02 '20
the idea that anything sporting enough parentheses is "a Lisp".
This is disingenuous. It is rather reasonable to call languages based on s-expressions, with cons pairs and lists as core data structures, and that are homoiconic and with macros "Lisps". If, you want to call languages that, in addition to that, have vectors/maps/sets as core data structures, a very strong emphasis on immutability and persistent data, and constructs for atomic/transactional mutation "Clojures", that might be reasonable.
Moreover, Lisp has a long tradition of various different languages and dialects implementing its ideas and calling themselves Lisps. The very fact that Common Lisp is called that rather than just Lisp shows that. In fact, unlike Clojure, today Lisp is not the name of a language at all, but of a family of languages. It is meant to be used in a generic rather than specific context.
0
Mar 02 '20
[deleted]
9
u/pron98 Mar 02 '20 edited Mar 02 '20
How is it that whenever one engages with one of these soi-disant "welcoming" communities, neither the downvotes nor the ad-homs ever seem in short supply?
I wouldn't know. I'm not in the Clojure community. I used it briefly about five years ago, and I like it, but I haven't programmed in Clojure for several years now, and I don't participate in Clojure communities either online or offline. That has nothing at all with your incorrect and disingenuous statement that Clojure claims to be a Lisp just because it is "sporting enough parentheses." S-expressions, homoiconicity and macros are its central syntactic framework. It's possible that making disingenuous and dismissive statements is what elicits downvotes.
So, not Clojure, which provides actual cons pairs as some kind of oh yeah, guess as "a Lisp" we should have those too afterthought.
No, that's not true. Most Clojure expressions are represented as cons-pair lists. Like in any Lisp, an expression of the form
(...)is a cons-pair list.I'd call Clojure "a Lisp" in a heartbeat—if it would obediently morph into one according to my set of criteria.
Which is? Also, it's not up to you. Clojure's designer says he designed Clojure as a Lisp, and it is widely regarded as such. So whether you consider Clojure a Lisp is an entirely different discussion. In any event, your statement that Clojure calls itself a Lisp just because it sports many parentheses is patently false.
It's a fluke of history.
That "fluke of history" is that for decades there had been quite a few Lisps before Common Lisp, and there have been quite a few Lisps since.
If ANSI C had been called Common C, would everybody likewise insist that "X is a C" just because it's one of a million curly-brace languages?
No, but that's not why Common Lisp is called Common Lisp. Even the Wikipedia page introduces it as a Lisp dialect, and the Wikipedia page for Lisp describes it as a family of languages, as it has been regarded for decades. You might argue about which languages deserve to belong in that family, but the situation is different from that of C.
0
Mar 02 '20
[deleted]
5
u/pron98 Mar 02 '20 edited Mar 02 '20
requires b to be a sequence, which is not how actual cons cells in Lisp work.
This is how actual cons-cells in this Lisp work. I am not aware of any specific guidelines about the details of cons cells in the Lisp family.
While entirely beside the point...
You didn't answer the question, and in any event, Clojure is widely regarded as a Lisp regardless of your thoughts on the matter, which, as I understand, are negative. That's fine, but unless someone declares herself to be the owner of the Lisp trademark and starts enforcing it with some clearly-defined rules, the programming community at large decides what a Lisp is, and it has decided Clojure is one. But feel free to pick fights on /r/Clojure as much as you like. I believe Clojure also has some dialects, and there are people who design other "Clojures" (e.g. Clojerl). So it's possible that it's not the fact that you want to write another Clojure that annoys the people you interact with, but the fact that you want to pick a fight.
It doesn't run any Clojure programs (like Clojure doesn't run any Lisp programs btw)? Doesn't matter!
Lisp is the name of a family of programming language, few of which can run programs written in other dialects. E.g. Scheme cannot run Common Lisp and vice-versa.
1
u/lispm Mar 04 '20
I am not aware of any specific guidelines about the details of cons cells in the Lisp family.
Well, you could read the Lisp 1 manual.
→ More replies (0)-2
u/the_evergrowing_fool Mar 02 '20
Haha language identity is a social construct now. That's hilarious.
Clojure doesn't support dotted pairs, so not a Lisp.
→ More replies (0)0
0
2
u/kankyo Mar 02 '20
Name checks out
0
Mar 02 '20
[deleted]
3
u/freakhill Mar 03 '20
Because you behave like an asshole.
Why do you expect people to treat you nicely when you behave like an asshole?
2
u/kankyo Mar 03 '20
Well if you engage in a hostile and petty way you will get the same in kind. Not really surprising. This is the default mode for all animals, not even unique for humans.
2
u/ObnoxiousFactczecher Mar 02 '20
Well, generally a Lisp would be largely compatible with old Lisp dialects. For example it would have a trio of functions CONS, CAR, CDR that you'd be able to write the same algorithms over linked lists in any implementation, with similar time and memory performance characteristics. But Clojure doesn't have a compatible API for this. On the other hand, Scheme does, although in other ways it's more further away from the "centroid of Lisps" than many other Lisps.
3
u/pron98 Mar 02 '20 edited Mar 03 '20
But Clojure doesn't have a compatible API for this.
It does --
conj(with reversed arguments) orcons,first,rest. What the handful of people who insist Clojure isn't a Lisp complain about is one thing: in Clojureconj/consrequires that the first/second argument be of some sequence type (inconj's case, if we're building sequences) rather than an arbitrary object. This has no effect on lists, and though it's been a while since I programmed in any Lisp, I don't recall such usage of cons cells being very common. Still, they think this is a crucial detail for the definition of a Lisp. This is a little hard to reconcile, because the reason McCarthy emphasized cons pairs to some degree is because of how minimal the resulting language is. I don't think Common Lisp, Clojure or Scheme are very minimal languages these days, whether or not, in addition to their many constructs, they also support a non-sequence second element of a cons cell.1
u/ObnoxiousFactczecher Mar 03 '20
It does -- conj (with reversed arguments) or cons, first, rest.
Does it have the same behavior as in Lisp? As in, for example, all these operations being O(1) in time and space?
I don't recall such usage of cons cells being very common
Alists are moderately common.
2
u/pron98 Mar 03 '20 edited Mar 03 '20
Does it have the same behavior as in Lisp? As in, for example, all these operations being O(1) in time and space?
Yep (although it allows multiple implementations, some of them could hypothetically provide different characteristics).
Alists are moderately common.
Yeah, but their representation exploits the simplicity of cons cells, simplicity that no modern Lisp really has anymore. Clojure, of course, supports this conceptual data structure, only with a different representation (map).
I would say that Clojure respects the general idea of a small number of basic data structures, but doesn't rely on cons cells as the only basic building block (nor do other Lisps that, for example, have vectors). Rather than doing everything with a single implementation of cons-cells (which other Lisps no longer do, either), it generalizes the idea to a small number of "protocols", some of them support those "cons-cell operations" and others support others (or the same ones, generalized; e.g. conj generalizes to other data structures).
1
u/lispm Mar 04 '20
It's not about support, it's about being based on. Lisps are based on cons cells and the data structures made out of them.
Clojure has a more complex lazy persistent sequence abstraction as its base.
It's just different.
2
u/pron98 Mar 04 '20
Lisps are based on cons cells and the data structures made out of them.
This is just not true. Both Scheme and Common Lisp have vectors, which aren't based on cons cells (at least not in Scheme).
1
u/lispm Mar 04 '20
This is just not true
Sure it is. vectors are just an addition to Lisp. You could remove vectors and still program in Lisp.
2
u/pron98 Mar 04 '20
You said "Lisps are based on cons cells and the data structures made out of them." But Common Lisp, Scheme and Clojure have data structures not made of cons cells. Plus, I would argue that that's not what Lisps are based on. Lisps are based on s-expressions, homoiconicity, and simple core data structures that are used to build more complex ones.
1
u/lispm Mar 04 '20
But Common Lisp, Scheme and Clojure have data structures not made of cons cells.
Lisp 1.5 had that, too.
Still the evaluator of Lisp 1.5 traverses cons trees and computes their values. APPLY takes a list of arguments. Bindings were lists of bindings. McCarthy communicated the basic evaluation model of Lisp by such an evaluator, which is made of a bunch of core facilities.
That evaluation model is what we still teach new Lisp users.
2
u/pron98 Mar 04 '20
Well, new Lispers that learn Clojure learn something just slightly different. As the Clojure website says:
cons,firstandrestmanipulate sequence abstractions, not concrete cons cellsThe comparison with other Lisps is here.
I admit Clojure is a more complex Lisp than Scheme, but their goals are different. Scheme was largely meant as an educational language (similarly Racket), while Clojure was intended to write large concurrent applications with good performance.
→ More replies (0)
7
u/funbrigade Mar 02 '20
Nice overview of a language community I have no experience with, but I'm really not sure how the author's conclusion is that Clojure is "slowly eating the world". Still a cool read!