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

281 lines
No EOL
5.3 KiB
HTML

<!DOCTYPE HTML>
<HTML LANG="en-us"
><HEAD
><TITLE
>acons | Common Lisp Nova Spec</TITLE
><META CHARSET="US-ASCII"
><LINK REL="canonical" HREF="f_acons.html"
><LINK REL="next" HREF="f_assoc.html" TYPE="text/html" TITLE="assoc, assoc-if, assoc-if-not"
><LINK REL="prev" HREF="f_mapc.html" TYPE="text/html" TITLE="mapc, mapcar, mapcan, mapl, maplist, mapcon"
><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_acons.html"
>acons</A
></SPAN
></DIV
><DIV CLASS="apropos"
><DIV CLASS="apropos-io"
><A HREF="f_mapc.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_assoc.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="acons"
></SPAN
><B
>acons</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
>acons</B
> <SPAN CLASS="cmssi"
>key</SPAN
> <SPAN CLASS="cmssi"
>datum</SPAN
> <SPAN CLASS="cmssi"
>alist</SPAN
> <SPAN CLASS="arrow"
>&#8594;</SPAN
> <SPAN CLASS="cmssi"
>new-alist</SPAN
></P
></DD
><DT
><B
>Arguments and Values</B
></DT
><DD
><P CLASS="j"
><VAR CLASS="param"
>key</VAR
> &#8212; an <A HREF="26_1_Glossary.html#object"
><EM CLASS="term"
>object</EM
></A
>. </P
><P CLASS="j"
><VAR CLASS="param"
>datum</VAR
> &#8212; an <A HREF="26_1_Glossary.html#object"
><EM CLASS="term"
>object</EM
></A
>. </P
><P CLASS="j"
><VAR CLASS="param"
>alist</VAR
> &#8212; an <A HREF="26_1_Glossary.html#association_list"
><EM CLASS="term"
>association list</EM
></A
>. </P
><P CLASS="j"
><VAR CLASS="param"
>new-alist</VAR
> &#8212; an <A HREF="26_1_Glossary.html#association_list"
><EM CLASS="term"
>association list</EM
></A
>.</P
></DD
><DT
><B
>Description</B
></DT
><DD
><P CLASS="j"
>Creates a <A HREF="26_1_Glossary.html#fresh"
><EM CLASS="term"
>fresh</EM
></A
> <A HREF="26_1_Glossary.html#cons"
><EM CLASS="term"
>cons</EM
></A
>, the <A HREF="26_1_Glossary.html#cdr"
><EM CLASS="term"
>cdr</EM
></A
> of which is <VAR CLASS="param"
>alist</VAR
> and the <A HREF="26_1_Glossary.html#car"
><EM CLASS="term"
>car</EM
></A
> of which is another <A HREF="26_1_Glossary.html#fresh"
><EM CLASS="term"
>fresh</EM
></A
> <A HREF="26_1_Glossary.html#cons"
><EM CLASS="term"
>cons</EM
></A
>, the <A HREF="26_1_Glossary.html#car"
><EM CLASS="term"
>car</EM
></A
> of which is <VAR CLASS="param"
>key</VAR
> and the <A HREF="26_1_Glossary.html#cdr"
><EM CLASS="term"
>cdr</EM
></A
> of which is <VAR CLASS="param"
>datum</VAR
>.</P
></DD
><DT
><B
>Examples</B
></DT
><DD
><PRE CLASS="screen"
>(setq alist '()) <SPAN CLASS="cmsy"
><SPAN CLASS="arrow"
>&#8594;</SPAN
></SPAN
> NIL
(acons 1 "one" alist) <SPAN CLASS="cmsy"
><SPAN CLASS="arrow"
>&#8594;</SPAN
></SPAN
> ((1 . "one"))
alist <SPAN CLASS="cmsy"
><SPAN CLASS="arrow"
>&#8594;</SPAN
></SPAN
> NIL
(setq alist (acons 1 "one" (acons 2 "two" alist))) <SPAN CLASS="cmsy"
><SPAN CLASS="arrow"
>&#8594;</SPAN
></SPAN
> ((1 . "one") (2 . "two"))
(assoc 1 alist) <SPAN CLASS="cmsy"
><SPAN CLASS="arrow"
>&#8594;</SPAN
></SPAN
> (1 . "one")
(setq alist (acons 1 "uno" alist)) <SPAN CLASS="cmsy"
><SPAN CLASS="arrow"
>&#8594;</SPAN
></SPAN
> ((1 . "uno") (1 . "one") (2 . "two"))
(assoc 1 alist) <SPAN CLASS="cmsy"
><SPAN CLASS="arrow"
>&#8594;</SPAN
></SPAN
> (1 . "uno")</PRE
></DD
><DT
><B
>See Also</B
></DT
><DD
><P CLASS="j"
><A HREF="f_assoc.html" CLASS="funref"
><B
>assoc</B
></A
>, <A HREF="f_pairlis.html" CLASS="funref"
><B
>pairlis</B
></A
></P
></DD
><DT
><B
>Notes</B
></DT
><DD
><PRE CLASS="screen"
>(acons <VAR CLASS="param"
>key</VAR
> <VAR CLASS="param"
>datum</VAR
> <VAR CLASS="param"
>alist</VAR
>) <SPAN CLASS="cmsy"
><SPAN STYLE="font-size:16px;vertical-align:-2px"
>&#8801;</SPAN
></SPAN
> (cons (cons <VAR CLASS="param"
>key</VAR
> <VAR CLASS="param"
>datum</VAR
>) <VAR CLASS="param"
>alist</VAR
>)</PRE
></DD
></DL
></DIV
></DIV
><DIV CLASS="footer"
><DIV CLASS="btmnav"
><A HREF="f_mapc.html" CLASS="prev"
>&#8592;</A
><A HREF="f_assoc.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
>