Adds an element to the beginning of a list, or constructs a dotted list
(cons new-first-element list-or-atom)
The value returned depends on the data type of list-or-atom. If list-or-atom is a list, cons returns that list with new-first-element added as the first item in the list. If list-or-atom is an atom, cons returns a dotted pair consisting of new-first-element and list-or-atom.
Command: (cons 'a '(b c d))
(A B C D)
Command: (cons '(a) '(b c d))
((A) B C D)
Command: (cons 'a 2)
(A . 2)
See Also
-
The
List Handling topic in the AutoLISP Developer's Guide.