4 ms·
> I’ve seen people saying that but never with an argument as to why. What do they mean? I don't know but if I had to guess, it's because lisp is list processin
by nordsieck 3y ago
> I’ve seen people saying that but never with an argument as to why. What do they mean?
I don't know but if I had to guess, it's because lisp is list processing language, and Clojure doesn't really support lists (I mean, it's possible to make some, but there are none out of the box); instead it has a variety of trees that mimic the runtime performance of lists, arrays, hashes, etc.
- deleted 3y ago[deleted]
- kgwxd 3y agoI’m not sure I understand how there are no lists out of the box in Clojure. What makes the data structures not valid lists? Basic lisp lists are nestable, doesn’t that make them trees? The underlying structure is to support immutability by default but that’s under the hood stuff. Conceptually and, I think more importantly, syntactically they’re list.
- nordsieck 3y agoI'm probably the wrong person to have this conversation with - I agree with you for the most part, and I think Clojure is a lisp. My guess was the only thing that I could really think of. That and the syntax support and integration of non-list datatypes into the core language (e.g. function syntax).
- cfiggers 3y agoAFAIU, "list" has a specific technical meaning when used by someone complaining about Clojure not having them. It has to do with the implementation details, not just the semantics of how they're used. Clojure has "sequences" or "seqs", which are semantically the closest to what lispers mean by a "list"—but also "vectors," denoted by square brackets, "maps," denoted by curly brackets, and "sets", denoted by curly brackets prefixed with a hash sign. Having these as core data structures violates the Lisp principle of "everything is just a list," and they introduce something other than round parens into the syntax, which looks really weird to those practiced with traditional/conventional Lisps. For those well-practiced in "true" Lisps, Clojure reads like a very strange hybrid (one might say "corruption") of Lisp and JSON.
- robto 3y agoWhen lispers talk about lists, they are usually speaking about a very specific type of data structure - a linked list of cons cells[0]. Clojure's lists are not actual chains of cons, they are immutable hash array map tries. This means that Common Lisp code can't interoperate with Clojure code. The precise/pedantic lisper may insist that since Lisp stands for List Processing and Lists are chains of cons cells and since Clojure doesn't have cons cells for the built-in lists, then Clojure is not a Lisp. If, however, you view lisp (lower case) as a family of homo-iconic languages that use s-expressions, then Clojure happily fits under that umbrella. The trick is to pay close attention to whether the person is talking about a Lisp (ANSI Common Lisp implementation) or a lisp (the family). Sometimes people say "lisp" when they are talking about "Lisp", which can cause some confusion. [0]https://en.wikipedia.org/wiki/Cons https://en.wikipedia.org/wiki/Cons
- wtetzner 3y agoClojure's lists are effectively cons cells. Clojure's vectors and maps are immutable hash array map tries. => (class (read-string "(some list)")) clojure.lang.PersistentList They are written in Java, and implement a bunch of interfaces, so the implementation looks complicated, but they are basically just classes with _first and _rest fields. https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/PersistentList.java#L20 https://github.com/clojure/clojure/blob/master/src/jvm/cloju...
- lispm 3y agoClojure uses a high-level data-structure for list like data. Lisp usually uses a very primitive data-structure (two-slot linked list cells). The main point is that Lisp actually has decades old established set of data structures, their operators and programming concepts. For example when I would have read a Lisp book, I would find explanations of these core datastructures and operators. In a Clojure book many things work sufficiently differently and also are named differently. In Lisp for example "atom" is a central concept. It's anything which is not a linked list element. In Clojure this word is used to name a completely different concept: a data structure to manage state. Clojure is more like Lisp, Java, SML put into a blender. The result may have a similar color, some traces of flavor, but other then that it is a new language.
- wtetzner 3y agoIt literally has a list type though. https://clojuredocs.org/clojure.core/list https://clojuredocs.org/clojure.core/list