User Tools

A PCRE internal error occured. This might be caused by a faulty plugin


This shows you the differences between two versions of the page.

Link to this comparison view

cl:functions:list [2019/09/14 05:00]
cl:functions:list [2020/08/05 18:00] (current)
Line 1: Line 1:
 +====== Function LIST, LIST* ======
 +**list** //''&​rest''​ objects// → //list//
 +**list*** //''&​rest''​ objects''​+''//​ → //result//
 +====Arguments and Values====
 +  * //object// - an //​[[CL:​Glossary:​object]]//​.
 +  * //list// - a //​[[CL:​Glossary:​list]]//​.
 +  * //result// - an //​[[CL:​Glossary:​object]]//​.
 +**list** returns a //​[[CL:​Glossary:​list]]//​ containing the supplied //​objects//​.
 +**list*** is like **list** except that the last //​[[CL:​Glossary:​argument]]//​ to **list** becomes the //​[[CL:​Glossary:​car]]//​ of the last //​[[CL:​Glossary:​cons]]//​ constructed,​ while the last //​[[CL:​Glossary:​argument]]//​ to **list*** becomes the //​[[CL:​Glossary:​cdr]]//​ of the last //​[[CL:​Glossary:​cons]]//​ constructed. Hence, any given call to **list*** always produces one fewer //​[[CL:​Glossary:​cons|conses]]//​ than a call to **list** with the same number of arguments.
 +If the last //​[[CL:​Glossary:​argument]]//​ to **list*** is a //​[[CL:​Glossary:​list]]//,​ the effect is to construct a new //​[[CL:​Glossary:​list]]//​ which is similar, but which has additional elements added to the front corresponding to the preceding //​[[CL:​Glossary:​argument|arguments]]//​ of **list***.
 +If **list*** receives only one //object//, that //object// is returned, regardless of whether or not it is a //​[[CL:​Glossary:​list]]//​.
 +(list 1) <​r>​(1)</​r>​
 +(list* 1) <​r>​1</​r>​
 +([[CL:​Macros:​defparameter]] *a* 1) <​r>​*A*</​r>​
 +(list *a* 2) <r>(1 2)</​r>​
 +'(*a* 2) <​r>​(*A* 2)</​r>​
 +(list '*a* 2) <​r>​(*A* 2)</​r>​
 +(list* *a* 2) <r>(1 . 2)</​r>​
 +(list) <​r>​NIL ; ≡ ()</​r>​
 +([[CL:​Macros:​setf]] *a* '(1 2)) <r>(1 2)</​r>​
 +(**[[CL:​Functions:​eq]]** *a* (list* *a*)) <​r>//​[[CL:​Glossary:​true]]//</​r>​
 +(list 3 4 'a (**[[CL:​Functions:​car]]** '(b . c)) (+ 6 -2)) <r>(3 4 A B 4)</​r>​
 +(list* 'a 'b 'c 'd) ≡ ([[CL:​Functions:​cons]] 'a ([[CL:​Functions:​cons]] 'b ([[CL:​Functions:​cons]] 'c 'd))) <r>(A B C . D)</​r>​
 +(list* 'a 'b 'c '(d e f)) <r>(A B C D E F)</​r>​
 +====Side Effects====
 +====Affected By====
 +====Exceptional Situations====
 +====See Also====
 +<​blockquote>​ (list* //x//) ≡ //x// </​blockquote>​