2 ms·
The result you got isn't actually what you'd get with proper cons cells. With real conses, you wouldn't get a list, you'd get an improper list, or a pair: i.e:
by qwertyuiop924 10y ago
The result you got isn't actually what you'd get with proper cons cells. With real conses, you wouldn't get a list, you'd get an improper list, or a pair: i.e:
Scheme:
(define x (cons 'a (cons 'b '())))
;> (a b)
(define y (cons 'a 'b))
;> (a . b)
(cdr x)
;> (b)
(cdr y)
;> b
(eq x y)
;> #f
If clojure doesn't behave like that, that it's not using real conses.
As for why a uniform cell structure is preferable, it's a preference thing, but I feel it makes dealing with lists and other cons-based structure (mostly lists, but you get the occaisional alist or plist or tree in there too) much nicer.