332 lines
7.2 KiB
HTML
332 lines
7.2 KiB
HTML
|
<!DOCTYPE HTML>
|
||
|
<HTML LANG="en-us"
|
||
|
><HEAD
|
||
|
><TITLE
|
||
|
>concatenate | Common Lisp Nova Spec</TITLE
|
||
|
><META CHARSET="US-ASCII"
|
||
|
><LINK REL="canonical" HREF="f_concatenate.html"
|
||
|
><LINK REL="next" HREF="f_merge.html" TYPE="text/html" TITLE="merge"
|
||
|
><LINK REL="prev" HREF="f_substitute.html" TYPE="text/html" TITLE="substitute, substitute-if, substitute-if-not, nsubstitute, nsubstitute-if, nsubstitute-if-not"
|
||
|
><LINK REL="up" HREF="17_3_Sequences_Dictionary.html" TYPE="text/html" TITLE="17.3 Sequences 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"
|
||
|
>→ <A HREF="17_Sequences.html"
|
||
|
>17. Sequences</A
|
||
|
></SPAN
|
||
|
> <SPAN CLASS="breadcrumb-item"
|
||
|
>→ <A HREF="17_3_Sequences_Dictionary.html"
|
||
|
>17.3 Sequences Dictionary</A
|
||
|
></SPAN
|
||
|
> <SPAN CLASS="breadcrumb-item"
|
||
|
>→ <A HREF="f_concatenate.html"
|
||
|
>concatenate</A
|
||
|
></SPAN
|
||
|
></DIV
|
||
|
><DIV CLASS="apropos"
|
||
|
><DIV CLASS="apropos-io"
|
||
|
><A HREF="f_substitute.html" CLASS="prev"
|
||
|
>←</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_merge.html" CLASS="next"
|
||
|
>→</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="concatenate"
|
||
|
></SPAN
|
||
|
><B
|
||
|
>concatenate</B
|
||
|
></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
|
||
|
>concatenate</B
|
||
|
> <SPAN CLASS="cmssi"
|
||
|
>result-type</SPAN
|
||
|
> <SPAN CLASS="cmtt"
|
||
|
>&rest</SPAN
|
||
|
> <SPAN CLASS="cmssi"
|
||
|
>sequences</SPAN
|
||
|
> <SPAN CLASS="arrow"
|
||
|
>→</SPAN
|
||
|
> <SPAN CLASS="cmssi"
|
||
|
>result-sequence</SPAN
|
||
|
></P
|
||
|
></DD
|
||
|
><DT
|
||
|
><B
|
||
|
>Arguments and Values</B
|
||
|
></DT
|
||
|
><DD
|
||
|
><P CLASS="j"
|
||
|
><VAR CLASS="param"
|
||
|
>result-type</VAR
|
||
|
> — a <A HREF="t_sequence.html" CLASS="typeref"
|
||
|
><B
|
||
|
>sequence</B
|
||
|
></A
|
||
|
> <A HREF="26_1_Glossary.html#type_specifier"
|
||
|
><EM CLASS="term"
|
||
|
>type specifier</EM
|
||
|
></A
|
||
|
>. </P
|
||
|
><P CLASS="j"
|
||
|
><VAR CLASS="param"
|
||
|
>sequences</VAR
|
||
|
> — a <A HREF="26_1_Glossary.html#sequence"
|
||
|
><EM CLASS="term"
|
||
|
>sequence</EM
|
||
|
></A
|
||
|
>. </P
|
||
|
><P CLASS="j"
|
||
|
><VAR CLASS="param"
|
||
|
>result-sequence</VAR
|
||
|
> — a <A HREF="26_1_Glossary.html#proper_sequence"
|
||
|
><EM CLASS="term"
|
||
|
>proper sequence</EM
|
||
|
></A
|
||
|
> of <A HREF="26_1_Glossary.html#type"
|
||
|
><EM CLASS="term"
|
||
|
>type</EM
|
||
|
></A
|
||
|
> <VAR CLASS="param"
|
||
|
>result-type</VAR
|
||
|
>.</P
|
||
|
></DD
|
||
|
><DT
|
||
|
><B
|
||
|
>Description</B
|
||
|
></DT
|
||
|
><DD
|
||
|
><P CLASS="j"
|
||
|
><A HREF="f_concatenate.html" CLASS="funref"
|
||
|
><B
|
||
|
>concatenate</B
|
||
|
></A
|
||
|
> returns a <A HREF="26_1_Glossary.html#sequence"
|
||
|
><EM CLASS="term"
|
||
|
>sequence</EM
|
||
|
></A
|
||
|
> that contains all the individual elements of all the <VAR CLASS="param"
|
||
|
>sequences</VAR
|
||
|
> in the order that they are supplied. The <A HREF="26_1_Glossary.html#sequence"
|
||
|
><EM CLASS="term"
|
||
|
>sequence</EM
|
||
|
></A
|
||
|
> is of type <VAR CLASS="param"
|
||
|
>result-type</VAR
|
||
|
>, which must be a <A HREF="26_1_Glossary.html#subtype"
|
||
|
><EM CLASS="term"
|
||
|
>subtype</EM
|
||
|
></A
|
||
|
> of <A HREF="26_1_Glossary.html#type"
|
||
|
><EM CLASS="term"
|
||
|
>type</EM
|
||
|
></A
|
||
|
> <A HREF="t_sequence.html" CLASS="typeref"
|
||
|
><B
|
||
|
>sequence</B
|
||
|
></A
|
||
|
>. </P
|
||
|
><P CLASS="j"
|
||
|
>All of the <VAR CLASS="param"
|
||
|
>sequences</VAR
|
||
|
> are copied from; the result does not share any structure with any of the <VAR CLASS="param"
|
||
|
>sequences</VAR
|
||
|
>. Therefore, if only one <VAR CLASS="param"
|
||
|
>sequence</VAR
|
||
|
> is provided and it is of type <VAR CLASS="param"
|
||
|
>result-type</VAR
|
||
|
>, <A HREF="f_concatenate.html" CLASS="funref"
|
||
|
><B
|
||
|
>concatenate</B
|
||
|
></A
|
||
|
> is required to copy <VAR CLASS="param"
|
||
|
>sequence</VAR
|
||
|
> rather than simply returning it. </P
|
||
|
><P CLASS="j"
|
||
|
>It is an error if any element of the <VAR CLASS="param"
|
||
|
>sequences</VAR
|
||
|
> cannot be an element of the <A HREF="26_1_Glossary.html#sequence"
|
||
|
><EM CLASS="term"
|
||
|
>sequence</EM
|
||
|
></A
|
||
|
> result. </P
|
||
|
><P CLASS="j"
|
||
|
>If the <VAR CLASS="param"
|
||
|
>result-type</VAR
|
||
|
> is a <A HREF="26_1_Glossary.html#subtype"
|
||
|
><EM CLASS="term"
|
||
|
>subtype</EM
|
||
|
></A
|
||
|
> of <A HREF="t_list.html" CLASS="typeref"
|
||
|
><B
|
||
|
>list</B
|
||
|
></A
|
||
|
>, the result will be a <A HREF="26_1_Glossary.html#list"
|
||
|
><EM CLASS="term"
|
||
|
>list</EM
|
||
|
></A
|
||
|
>. </P
|
||
|
><P CLASS="j"
|
||
|
>If the <VAR CLASS="param"
|
||
|
>result-type</VAR
|
||
|
> is a <A HREF="26_1_Glossary.html#subtype"
|
||
|
><EM CLASS="term"
|
||
|
>subtype</EM
|
||
|
></A
|
||
|
> of <A HREF="t_vector.html" CLASS="typeref"
|
||
|
><B
|
||
|
>vector</B
|
||
|
></A
|
||
|
>, then if the implementation can determine the element type specified for the <VAR CLASS="param"
|
||
|
>result-type</VAR
|
||
|
>, the element type of the resulting array is the result of <A HREF="26_1_Glossary.html#upgrade"
|
||
|
><EM CLASS="term"
|
||
|
>upgrading</EM
|
||
|
></A
|
||
|
> that element type; or, if the implementation can determine that the element type is unspecified (or <CODE CLASS="f"
|
||
|
>*</CODE
|
||
|
>), the element type of the resulting array is <A HREF="t_t.html" CLASS="typeref"
|
||
|
><B
|
||
|
>t</B
|
||
|
></A
|
||
|
>; otherwise, an error is signaled.</P
|
||
|
></DD
|
||
|
><DT
|
||
|
><B
|
||
|
>Examples</B
|
||
|
></DT
|
||
|
><DD
|
||
|
><PRE CLASS="screen"
|
||
|
>(concatenate 'string "all" " " "together" " " "now") <SPAN CLASS="cmsy"
|
||
|
><SPAN CLASS="arrow"
|
||
|
>→</SPAN
|
||
|
></SPAN
|
||
|
> "all together now"
|
||
|
(concatenate 'list "ABC" '(d e f) #(1 2 3) #*1011)
|
||
|
<SPAN CLASS="cmsy"
|
||
|
><SPAN CLASS="arrow"
|
||
|
>→</SPAN
|
||
|
></SPAN
|
||
|
> (#\A #\B #\C D E F 1 2 3 1 0 1 1)
|
||
|
(concatenate 'list) <SPAN CLASS="cmsy"
|
||
|
><SPAN CLASS="arrow"
|
||
|
>→</SPAN
|
||
|
></SPAN
|
||
|
> NIL</PRE
|
||
|
><PRE CLASS="screen"
|
||
|
>(concatenate '(vector * 2) "a" "bc") should signal an error</PRE
|
||
|
></DD
|
||
|
><DT
|
||
|
><B
|
||
|
>Exceptional Situations</B
|
||
|
></DT
|
||
|
><DD
|
||
|
><P CLASS="j"
|
||
|
>An error is signaled if the <VAR CLASS="param"
|
||
|
>result-type</VAR
|
||
|
> is neither a <A HREF="26_1_Glossary.html#recognizable_subtype"
|
||
|
><EM CLASS="term"
|
||
|
>recognizable subtype</EM
|
||
|
></A
|
||
|
> of <A HREF="t_list.html" CLASS="typeref"
|
||
|
><B
|
||
|
>list</B
|
||
|
></A
|
||
|
>, nor a <A HREF="26_1_Glossary.html#recognizable_subtype"
|
||
|
><EM CLASS="term"
|
||
|
>recognizable subtype</EM
|
||
|
></A
|
||
|
> of <A HREF="t_vector.html" CLASS="typeref"
|
||
|
><B
|
||
|
>vector</B
|
||
|
></A
|
||
|
>. </P
|
||
|
><P CLASS="j"
|
||
|
>An error of <A HREF="26_1_Glossary.html#type"
|
||
|
><EM CLASS="term"
|
||
|
>type</EM
|
||
|
></A
|
||
|
> <A HREF="t_type-error.html" CLASS="typeref"
|
||
|
><B
|
||
|
>type-error</B
|
||
|
></A
|
||
|
> should be signaled if <VAR CLASS="param"
|
||
|
>result-type</VAR
|
||
|
> specifies the number of elements and the sum of <VAR CLASS="param"
|
||
|
>sequences</VAR
|
||
|
> is different from that number.</P
|
||
|
></DD
|
||
|
><DT
|
||
|
><B
|
||
|
>See Also</B
|
||
|
></DT
|
||
|
><DD
|
||
|
><P CLASS="j"
|
||
|
><A HREF="f_append.html" CLASS="funref"
|
||
|
><B
|
||
|
>append</B
|
||
|
></A
|
||
|
></P
|
||
|
></DD
|
||
|
></DL
|
||
|
></DIV
|
||
|
></DIV
|
||
|
><DIV CLASS="footer"
|
||
|
><DIV CLASS="btmnav"
|
||
|
><A HREF="f_substitute.html" CLASS="prev"
|
||
|
>←</A
|
||
|
><A HREF="f_merge.html" CLASS="next"
|
||
|
>→</A
|
||
|
></DIV
|
||
|
><DIV CLASS="trail"
|
||
|
>Conversion to HTML copyright 2023 by Gilbert Baumann</DIV
|
||
|
></DIV
|
||
|
></DIV
|
||
|
><SCRIPT
|
||
|
>domReady();</SCRIPT
|
||
|
></BODY
|
||
|
></HTML
|
||
|
>
|