1
0
Fork 0
cl-sites/novaspec.org/cl/f_list.html
2025-02-05 18:52:26 +01:00

385 lines
No EOL
7.2 KiB
HTML

<!DOCTYPE HTML>
<HTML LANG="en-us"
><HEAD
><TITLE
>list, list* | Common Lisp Nova Spec</TITLE
><META CHARSET="US-ASCII"
><LINK REL="canonical" HREF="f_list.html"
><LINK REL="next" HREF="f_list-length.html" TYPE="text/html" TITLE="list-length"
><LINK REL="prev" HREF="f_copy-list.html" TYPE="text/html" TITLE="copy-list"
><LINK REL="up" HREF="14_2_Conses_Dictionary.html" TYPE="text/html" TITLE="14.2 Conses Dictionary"
><LINK REL="start" HREF="index.html" TYPE="text/html" TITLE="Common Lisp Nova Spec"
><META NAME="VIEWPORT" CONTENT="width=device-width, initial-scale=1.0"
><LINK REL="STYLESHEET" HREF="dpans.css%3F3909942064.css"
><SCRIPT SRC="dpans.js%3F3909942064"
></SCRIPT
><SCRIPT SRC="apropos.js%3F3909942064"
></SCRIPT
></HEAD
><BODY
><DIV
><DIV CLASS="topnav"
><DIV CLASS="breadcrumb"
><SPAN CLASS="breadcrumb-item"
><A HREF="index.html"
>Common Lisp Nova Spec</A
></SPAN
> <SPAN CLASS="breadcrumb-item"
>&#8594; <A HREF="14_Conses.html"
>14. Conses</A
></SPAN
> <SPAN CLASS="breadcrumb-item"
>&#8594; <A HREF="14_2_Conses_Dictionary.html"
>14.2 Conses Dictionary</A
></SPAN
> <SPAN CLASS="breadcrumb-item"
>&#8594; <A HREF="f_list.html"
>list, list*</A
></SPAN
></DIV
><DIV CLASS="apropos"
><DIV CLASS="apropos-io"
><A HREF="f_copy-list.html" CLASS="prev"
>&#8592;</A
><SPAN ID="apropos-label"
>Apropos </SPAN
><INPUT ID="apropos" AUTOFOCUS="AUTOFOCUS" PLACEHOLDER="Type here to search" ONINPUT="aproposInput(this);" ONKEYUP="aproposKeyup(event);" ONCHANGE="aproposChange(this);" ONFOCUS="aproposFocus(this);" ONFOCUSOUT="aproposFocusout(this);"
><A HREF="f_list-length.html" CLASS="next"
>&#8594;</A
></DIV
><DIV ID="apropos-res"
></DIV
></DIV
></DIV
><DIV CLASS="matter"
><DIV CLASS="com"
><DIV CLASS="begincom"
><HR
><TABLE WIDTH="100%" CELLSPACING="0" CELLPADDING="0"
><TR
><TD ALIGN="LEFT" VALIGN="BASELINE" WIDTH="100%" CLASS="name"
><SPAN CLASS="idx" DATA-KIND="idxref" DATA-TERM="list, list*"
></SPAN
><B
>list, list</B
><SPAN CLASS="cmsy"
>*</SPAN
></TD
><TD ALIGN="RIGHT" VALIGN="BASELINE" WIDTH="0" NOWRAP="NOWRAP" CLASS="ftype"
><I
>Function</I
></TD
></TR
></TABLE
><HR
></DIV
><UL CLASS="subtoc"
></UL
><DL
><DT
><B
>Syntax</B
></DT
><DD
><P CLASS="j"
><B
>list</B
> <SPAN CLASS="cmtt"
>&amp;rest</SPAN
> <SPAN CLASS="cmssi"
>objects</SPAN
> <SPAN CLASS="arrow"
>&#8594;</SPAN
> <SPAN CLASS="cmssi"
>list</SPAN
></P
><P CLASS="j"
><B
>list*</B
> <SPAN CLASS="cmtt"
>&amp;rest</SPAN
> <SPAN CLASS="cmssi"
>objects</SPAN
><SUP CLASS="sup"
><SPAN CLASS="cmssi"
>+</SPAN
></SUP
> <SPAN CLASS="arrow"
>&#8594;</SPAN
> <SPAN CLASS="cmssi"
>result</SPAN
></P
></DD
><DT
><B
>Arguments and Values</B
></DT
><DD
><P CLASS="j"
><VAR CLASS="param"
>object</VAR
> &#8212; an <A HREF="26_1_Glossary.html#object"
><EM CLASS="term"
>object</EM
></A
>. </P
><P CLASS="j"
><VAR CLASS="param"
>list</VAR
> &#8212; a <A HREF="26_1_Glossary.html#list"
><EM CLASS="term"
>list</EM
></A
>. </P
><P CLASS="j"
><VAR CLASS="param"
>result</VAR
> &#8212; an <A HREF="26_1_Glossary.html#object"
><EM CLASS="term"
>object</EM
></A
>.</P
></DD
><DT
><B
>Description</B
></DT
><DD
><P CLASS="j"
><A HREF="f_list.html" CLASS="funref"
><B
>list</B
></A
> returns a <A HREF="26_1_Glossary.html#list"
><EM CLASS="term"
>list</EM
></A
> containing the supplied <VAR CLASS="param"
>objects</VAR
>. </P
><P CLASS="j"
><A HREF="f_list.html" CLASS="funref"
><B
>list*</B
></A
> is like <A HREF="f_list.html" CLASS="funref"
><B
>list</B
></A
> except that the last <A HREF="26_1_Glossary.html#argument"
><EM CLASS="term"
>argument</EM
></A
> to <A HREF="f_list.html" CLASS="funref"
><B
>list</B
></A
> becomes the <A HREF="26_1_Glossary.html#car"
><EM CLASS="term"
>car</EM
></A
> of the last <A HREF="26_1_Glossary.html#cons"
><EM CLASS="term"
>cons</EM
></A
> constructed, while the last <A HREF="26_1_Glossary.html#argument"
><EM CLASS="term"
>argument</EM
></A
> to <A HREF="f_list.html" CLASS="funref"
><B
>list*</B
></A
> becomes the <A HREF="26_1_Glossary.html#cdr"
><EM CLASS="term"
>cdr</EM
></A
> of the last <A HREF="26_1_Glossary.html#cons"
><EM CLASS="term"
>cons</EM
></A
> constructed. Hence, any given call to <A HREF="f_list.html" CLASS="funref"
><B
>list*</B
></A
> always produces one fewer <A HREF="26_1_Glossary.html#cons"
><EM CLASS="term"
>conses</EM
></A
> than a call to <A HREF="f_list.html" CLASS="funref"
><B
>list</B
></A
> with the same number of arguments. </P
><P CLASS="j"
>If the last <A HREF="26_1_Glossary.html#argument"
><EM CLASS="term"
>argument</EM
></A
> to <A HREF="f_list.html" CLASS="funref"
><B
>list*</B
></A
> is a <A HREF="26_1_Glossary.html#list"
><EM CLASS="term"
>list</EM
></A
>, the effect is to construct a new <A HREF="26_1_Glossary.html#list"
><EM CLASS="term"
>list</EM
></A
> which is similar, but which has additional elements added to the front corresponding to the preceding <A HREF="26_1_Glossary.html#argument"
><EM CLASS="term"
>arguments</EM
></A
> of <A HREF="f_list.html" CLASS="funref"
><B
>list*</B
></A
>. </P
><P CLASS="j"
>If <A HREF="f_list.html" CLASS="funref"
><B
>list*</B
></A
> receives only one <VAR CLASS="param"
>object</VAR
>, that <VAR CLASS="param"
>object</VAR
> is returned, regardless of whether or not it is a <A HREF="26_1_Glossary.html#list"
><EM CLASS="term"
>list</EM
></A
>.</P
></DD
><DT
><B
>Examples</B
></DT
><DD
><PRE CLASS="screen"
>(list 1) <SPAN CLASS="cmsy"
><SPAN CLASS="arrow"
>&#8594;</SPAN
></SPAN
> (1)
(list* 1) <SPAN CLASS="cmsy"
><SPAN CLASS="arrow"
>&#8594;</SPAN
></SPAN
> 1
(setq a 1) <SPAN CLASS="cmsy"
><SPAN CLASS="arrow"
>&#8594;</SPAN
></SPAN
> 1
(list a 2) <SPAN CLASS="cmsy"
><SPAN CLASS="arrow"
>&#8594;</SPAN
></SPAN
> (1 2)
'(a 2) <SPAN CLASS="cmsy"
><SPAN CLASS="arrow"
>&#8594;</SPAN
></SPAN
> (A 2)
(list 'a 2) <SPAN CLASS="cmsy"
><SPAN CLASS="arrow"
>&#8594;</SPAN
></SPAN
> (A 2)
(list* a 2) <SPAN CLASS="cmsy"
><SPAN CLASS="arrow"
>&#8594;</SPAN
></SPAN
> (1 . 2)
(list) <SPAN CLASS="cmsy"
><SPAN CLASS="arrow"
>&#8594;</SPAN
></SPAN
> NIL ;<I CLASS="i"
><I
>i.e.</I
></I
>, ()
(setq a '(1 2)) <SPAN CLASS="cmsy"
><SPAN CLASS="arrow"
>&#8594;</SPAN
></SPAN
> (1 2)
(eq a (list* a)) <SPAN CLASS="cmsy"
><SPAN CLASS="arrow"
>&#8594;</SPAN
></SPAN
> <A HREF="26_1_Glossary.html#true"
><EM CLASS="term"
>true</EM
></A
>
(list 3 4 'a (car '(b . c)) (+ 6 -2)) <SPAN CLASS="cmsy"
><SPAN CLASS="arrow"
>&#8594;</SPAN
></SPAN
> (3 4 A B 4)
(list* 'a 'b 'c 'd) <SPAN CLASS="cmsy"
><SPAN STYLE="font-size:16px;vertical-align:-2px"
>&#8801;</SPAN
></SPAN
> (cons 'a (cons 'b (cons 'c 'd))) <SPAN CLASS="cmsy"
><SPAN CLASS="arrow"
>&#8594;</SPAN
></SPAN
> (A B C . D)
(list* 'a 'b 'c '(d e f)) <SPAN CLASS="cmsy"
><SPAN CLASS="arrow"
>&#8594;</SPAN
></SPAN
> (A B C D E F)</PRE
></DD
><DT
><B
>See Also</B
></DT
><DD
><P CLASS="j"
><A HREF="f_cons.html" CLASS="funref"
><B
>cons</B
></A
></P
></DD
><DT
><B
>Notes</B
></DT
><DD
><PRE CLASS="screen"
>(list* <VAR CLASS="param"
>x</VAR
>) <SPAN CLASS="cmsy"
><SPAN STYLE="font-size:16px;vertical-align:-2px"
>&#8801;</SPAN
></SPAN
> <VAR CLASS="param"
>x</VAR
></PRE
></DD
></DL
></DIV
></DIV
><DIV CLASS="footer"
><DIV CLASS="btmnav"
><A HREF="f_copy-list.html" CLASS="prev"
>&#8592;</A
><A HREF="f_list-length.html" CLASS="next"
>&#8594;</A
></DIV
><DIV CLASS="trail"
>Conversion to HTML copyright 2023 by Gilbert Baumann</DIV
></DIV
></DIV
><SCRIPT
>domReady();</SCRIPT
></BODY
></HTML
>