2 ms·
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
by abecedarius 2y ago
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.)
- akater 2y agoNote 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.