User Tools


Differences

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

Link to this comparison view

cl:functions:make-list [2019/09/14 05:00]
cl:functions:make-list [2019/09/22 06:00] (current)
Line 1: Line 1:
 +====== Function MAKE-LIST ======
 +
 +====Syntax====
 +  * **make-list** //size ''&​key''​ initial-element//​ → //list//
 +                                   
 +====Arguments and Values====
 +  * //size// - a non-negative //​[[CL:​Glossary:​integer]]//​.
 +  * //​initial-element//​ - an //​[[CL:​Glossary:​object]]//​. The default is **[[CL:​Constant Variable:​nil]]**.
 +  * //list// - a //​[[CL:​Glossary:​list]]//​.
 +
 +====Description====
 +Returns a //​[[CL:​Glossary:​list]]//​ of //length// given by //​[[CL:​Glossary:​size]]//,​ each of the //​[[CL:​Glossary:​element|elements]]//​ of which is //​initial-element//​.
 +
 +====Examples====
 +<​blockquote>​
 +(make-list 5) <​r>​([[CL:​Constant Variable:​nil|NIL]] [[CL:​Constant Variable:​nil|NIL]] [[CL:​Constant Variable:​nil|NIL]] [[CL:​Constant Variable:​nil|NIL]] [[CL:​Constant Variable:​nil|NIL]])</​r>​
 +(make-list 3 :​initial-element 'rah) <​r>​(RAH RAH RAH)</​r>​
 +(make-list 2 :​initial-element '(1 2 3)) <​r>​((1 2 3) (1 2 3))</​r>​
 +(make-list 0) <​r>​[[CL:​Constant Variable:​nil|NIL]] ; ≡ ()</​r>​
 +(make-list 0 :​initial-element '​new-element) <​r>​[[CL:​Constant Variable:​nil|NIL]] </r>
 +</​blockquote>​
 +
 +====Side Effects====
 +None.
 +
 +====Affected By====
 +None.
 +
 +====Exceptional Situations====
 +Should signal an error of type type-error if //size// is not a non-negative //​[[CL:​Glossary:​integer]]//​.
 +
 +====See Also====
 +**[[CL:​Functions:​cons|Function CONS]]**, **[[CL:​Functions:​list|Function LIST]]**
 +
 +====Example Implementation====
 +To be done.
 +
 +====Notes====
 +None.
 +