News for hackers. Stuff that matters.
Re:Why does Lisp use cons cells? (1998) by abecedarius on Friday October 04, 2024 @12:58PM (#41743300)
That original post started with

> (list 1 2 3) == (cons 1 (cons 2 (cons 3 nil)))

and I'd have answered that cons could be a variable-arity function such that

> (list 1 2 3) == (cons 1 2 3 nil)

and maybe that'd help this newbie's intuition. (Common Lisp does have this variable-arity cons but by a different name list*, for some reason.)

Re:Why does Lisp use cons cells? (1998) by akater on Wednesday October 09, 2024 @08:42AM (#41787293)
Note that the value returned by cons is guaranteed to have type cons, and it is guaranteed that a fresh cons is created. Neither is true for list*; note that its return type is t.