Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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.)



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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: