Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

It is not completely different, but rather quite similar [1]. Clojure adds the concept of protocols, which it uses to abstract over cons cells (and it requires that the second element of the cell is an ISeq rather than an arbitrary object).

[1]: You can see the implementation of Clojure's cons cell here: https://github.com/clojure/clojure/blob/clojure-1.9.0/src/jv...



(cons 1 2) is doing what in Clojure?

In Lisp cons cells are the basic data type from which lists, trees, cyclic lists, etc. are created,

In Clojure it's not.


First, in Scheme, vectors are not made of cons cells.

Second, in Clojure, you can certainly make lists, trees etc. from cons cells. It's just that vectors and maps are more common.

Third, Clojure is not only a Lisp (https://clojure.org/about/lisp), but an exceptionally good one at that. I'm amazed that some people find that controversial. I love Scheme and Clojure, and the thought that they're not both Lisps -- something immediately obvious to any long-time Lisper like me -- strikes me as patently bizarre. Clojure is not only a very good Lisp, but celebrated among Lispers for facilitating Lisp's rise in popularity in recent years.


> First, in Scheme, vectors are not made of cons cells.

Lisp, too, has vectors not made of cons cells.

> make lists, trees etc. from cons cells

It's just that they aren't. Clojure uses persistent lazy sequences not made of cons cells as its basic data structure. And it has strange behavior:

  user=> (conj '(1 2) 0)
  (0 1 2)
  user=> (cons 0 '(1 2))
  (0 1 2)
Thus we have the same external representation.

  user=> (class (conj '(1 2) 0))
  clojure.lang.PersistentList
  user=> (class (cons 0 '(1 2)))
  clojure.lang.Cons
But they are of different class?

  user=> (class (cons 1 2))
  IllegalArgumentException Don't know how to create ISeq from: java.lang.Long  clojure.lang.RT.seqFrom (RT.java:542)
When we call cons with two args we get a Java error with a line number?

Does not look like Lisp to me.

> Clojure is not only a very good Lisp

It's a good programming language, but not a very good Lisp - since it is mostly incompatible and lacks a lot of the usual Lisp features.


> When we call cons with two args we get a Java error with a line number?

Clojure requires that the second element in the pair be an ISeq.

> since it is mostly incompatible and lacks a lot of the usual Lisp features.

I and many others disagree, including Clojure's designers, who designed it as a Lisp. Homoiconicity, macros, S-expressions and FP make a language a Lisp. OCaml and SML are about as different as Scheme and Clojure, yet no one thinks they're not both MLs.


> Clojure requires that the second element in the pair be an ISeq.

Lisp doesn't have such a requirement and does not have 'ISeqs'.

> I and many others disagree,

That does not make a convincing argument, since you have never used an actual Lisp - as you recently said.

> including Clojure's designers, who designed it as a Lisp.

Derived from Lisp mostly as a blend of FP, Java hosting/integration and Lisp ideas.

> Homoiconicity, macros, S-expressions and FP make a language a Lisp.

Lists are deprecated in Clojure (for maps, sets, vectors, ...), No interpreter, no Lisp down to the metal, no Lisp in Lisp, no images, core Lisp data structures look different, different API, different syntax, impoverished REPL, strange numerics, Java leaking in many places, lots of compromises because of implementing it on top of a not-Lisp-friendly VM, ...

Lisp derived, but Lisp looks & feels a bit different.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: