by ventuspilot · 2y ago · 0 comments
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. 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. user=> (list? (cons 1 '(2 3)))
true Clojure 1.11.3
user=> (list? (cons 1 '(2 3)))
falseIf it's inconsistent between variants then I'm absolutely not going to code in it...
Like declaring some mini-C 'ANSI C compatible' and you can't even provide a complete but basic stdio.h header.