top | item 40488368

(no title)

ventuspilot | 1 year ago

-> the Lisp linked lists were gone

Cons cells and linked lists are not completely gone, though:

    user=> (cons 1 (cons 2 nil))
    (1 2)
Cons cells however are somewhat limited in that the second argument to cons must be an ISeq.

discuss

order

lispm|1 year ago

and then you get this in Clojure:

  user=> (list? (cons 1 '(2 3)))
  false
  user=> (cons 1 '(2 3))
  (1 2 3)
That's "strange", isn't it? It prints as (1 2 3), but it is not a list? So there are things which print as lists, but aren't lists? What? Which also means that when we print it and read it back, it will be of a different type and list? will be true?!

  ELISP> (listp (cons 1 '(2 3)))
  t
Puh, Emacs Lisp got it right.

behnamoh|1 year ago

I just tried your first example on tryclojure.org and it returned "true":

    user=> (list? (cons 1 '(2 3)))
    true

anthk|1 year ago

Yes, I'm tired of Clojure fanboys recommending their language as a Lisp. It's not.