3158 lines
No EOL
73 KiB
HTML
3158 lines
No EOL
73 KiB
HTML
<!DOCTYPE HTML>
|
|
<HTML LANG="en-us"
|
|
><HEAD
|
|
><TITLE
|
|
>5.1 Generalized Reference | Common Lisp Nova Spec</TITLE
|
|
><META CHARSET="US-ASCII"
|
|
><LINK REL="canonical" HREF="5_1_Generalized_Reference.html"
|
|
><LINK REL="next" HREF="5_2_Transfer_of_Control_to_an_Exit_Point.html" TYPE="text/html" TITLE="5.2 Transfer of Control to an Exit Point"
|
|
><LINK REL="prev" HREF="5_Data_and_Control_Flow.html" TYPE="text/html" TITLE="5. Data and Control Flow"
|
|
><LINK REL="up" HREF="5_Data_and_Control_Flow.html" TYPE="text/html" TITLE="5. Data and Control Flow"
|
|
><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="5_Data_and_Control_Flow.html"
|
|
>5. Data and Control Flow</A
|
|
></SPAN
|
|
> <SPAN CLASS="breadcrumb-item"
|
|
>→ <A HREF="5_1_Generalized_Reference.html"
|
|
>5.1 Generalized Reference</A
|
|
></SPAN
|
|
></DIV
|
|
><DIV CLASS="apropos"
|
|
><DIV CLASS="apropos-io"
|
|
><A HREF="5_Data_and_Control_Flow.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="5_2_Transfer_of_Control_to_an_Exit_Point.html" CLASS="next"
|
|
>→</A
|
|
></DIV
|
|
><DIV ID="apropos-res"
|
|
></DIV
|
|
></DIV
|
|
></DIV
|
|
><DIV CLASS="matter"
|
|
><SECTION
|
|
><H2 ID="sec_5_1" CLASS="HeadII"
|
|
>5.1 Generalized Reference</H2
|
|
><UL CLASS="subtoc"
|
|
><LI
|
|
><A HREF="5_1_Generalized_Reference.html#sec_5_1_1"
|
|
>5.1.1 Overview of Places and Generalized Reference</A
|
|
></LI
|
|
><LI
|
|
><A HREF="5_1_Generalized_Reference.html#sec_5_1_1_1"
|
|
>5.1.1.1 Evaluation of Subforms to Places</A
|
|
></LI
|
|
><LI
|
|
><A HREF="5_1_Generalized_Reference.html#sec_5_1_1_1_1"
|
|
>5.1.1.1.1 Examples of Evaluation of Subforms to Places</A
|
|
></LI
|
|
><LI
|
|
><A HREF="5_1_Generalized_Reference.html#sec_5_1_1_2"
|
|
>5.1.1.2 Setf Expansions</A
|
|
></LI
|
|
><LI
|
|
><A HREF="5_1_Generalized_Reference.html#sec_5_1_1_2_1"
|
|
>5.1.1.2.1 Examples of Setf Expansions</A
|
|
></LI
|
|
><LI
|
|
><A HREF="5_1_Generalized_Reference.html#sec_5_1_2"
|
|
>5.1.2 Kinds of Places</A
|
|
></LI
|
|
><LI
|
|
><A HREF="5_1_Generalized_Reference.html#sec_5_1_2_1"
|
|
>5.1.2.1 Variable Names as Places</A
|
|
></LI
|
|
><LI
|
|
><A HREF="5_1_Generalized_Reference.html#sec_5_1_2_2"
|
|
>5.1.2.2 Function Call Forms as Places</A
|
|
></LI
|
|
><LI
|
|
><A HREF="5_1_Generalized_Reference.html#sec_5_1_2_3"
|
|
>5.1.2.3 VALUES Forms as Places</A
|
|
></LI
|
|
><LI
|
|
><A HREF="5_1_Generalized_Reference.html#sec_5_1_2_4"
|
|
>5.1.2.4 THE Forms as Places</A
|
|
></LI
|
|
><LI
|
|
><A HREF="5_1_Generalized_Reference.html#sec_5_1_2_5"
|
|
>5.1.2.5 APPLY Forms as Places</A
|
|
></LI
|
|
><LI
|
|
><A HREF="5_1_Generalized_Reference.html#sec_5_1_2_6"
|
|
>5.1.2.6 Setf Expansions and Places</A
|
|
></LI
|
|
><LI
|
|
><A HREF="5_1_Generalized_Reference.html#sec_5_1_2_7"
|
|
>5.1.2.7 Macro Forms as Places</A
|
|
></LI
|
|
><LI
|
|
><A HREF="5_1_Generalized_Reference.html#sec_5_1_2_8"
|
|
>5.1.2.8 Symbol Macros as Places</A
|
|
></LI
|
|
><LI
|
|
><A HREF="5_1_Generalized_Reference.html#sec_5_1_2_9"
|
|
>5.1.2.9 Other Compound Forms as Places</A
|
|
></LI
|
|
><LI
|
|
><A HREF="5_1_Generalized_Reference.html#sec_5_1_3"
|
|
>5.1.3 Treatment of Other Macros Based on SETF</A
|
|
></LI
|
|
></UL
|
|
><H3 ID="sec_5_1_1" CLASS="HeadIII"
|
|
>5.1.1 Overview of Places and Generalized Reference</H3
|
|
><P CLASS="j"
|
|
>A <DFN CLASS="newterm"
|
|
><SPAN CLASS="cmbxsl"
|
|
>generalized</SPAN
|
|
> <SPAN CLASS="cmbxsl"
|
|
>reference</SPAN
|
|
></DFN
|
|
> <SPAN CLASS="idx" DATA-KIND="idxterm" DATA-TERM="generalized reference"
|
|
></SPAN
|
|
>is the use of a <A HREF="26_1_Glossary.html#form"
|
|
><EM CLASS="term"
|
|
>form</EM
|
|
></A
|
|
>, sometimes called a <DFN CLASS="newterm"
|
|
><SPAN CLASS="cmbxsl"
|
|
>place</SPAN
|
|
></DFN
|
|
><SPAN CLASS="idx" DATA-KIND="idxterm" DATA-TERM="place"
|
|
></SPAN
|
|
>, as if it were a <A HREF="26_1_Glossary.html#variable"
|
|
><EM CLASS="term"
|
|
>variable</EM
|
|
></A
|
|
> that could be read and written. The <A HREF="26_1_Glossary.html#value"
|
|
><EM CLASS="term"
|
|
>value</EM
|
|
></A
|
|
> of a <A HREF="26_1_Glossary.html#place"
|
|
><EM CLASS="term"
|
|
>place</EM
|
|
></A
|
|
> is the <A HREF="26_1_Glossary.html#object"
|
|
><EM CLASS="term"
|
|
>object</EM
|
|
></A
|
|
> to which the <A HREF="26_1_Glossary.html#place"
|
|
><EM CLASS="term"
|
|
>place</EM
|
|
></A
|
|
> <A HREF="26_1_Glossary.html#form"
|
|
><EM CLASS="term"
|
|
>form</EM
|
|
></A
|
|
> evaluates. The <A HREF="26_1_Glossary.html#value"
|
|
><EM CLASS="term"
|
|
>value</EM
|
|
></A
|
|
> of a <A HREF="26_1_Glossary.html#place"
|
|
><EM CLASS="term"
|
|
>place</EM
|
|
></A
|
|
> can be changed by using <A HREF="f_setf.html" CLASS="macref"
|
|
><B
|
|
>setf</B
|
|
></A
|
|
>. The concept of binding a <A HREF="26_1_Glossary.html#place"
|
|
><EM CLASS="term"
|
|
>place</EM
|
|
></A
|
|
> is not defined in Common Lisp, but an <A HREF="26_1_Glossary.html#implementation"
|
|
><EM CLASS="term"
|
|
>implementation</EM
|
|
></A
|
|
> is permitted to extend the language by defining this concept. </P
|
|
><P CLASS="j"
|
|
>Figure 5–1 contains examples of the use of <A HREF="f_setf.html" CLASS="macref"
|
|
><B
|
|
>setf</B
|
|
></A
|
|
>. Note that the values returned by evaluating the <A HREF="26_1_Glossary.html#form"
|
|
><EM CLASS="term"
|
|
>forms</EM
|
|
></A
|
|
> in column two are not necessarily the same as those obtained by evaluating the <A HREF="26_1_Glossary.html#form"
|
|
><EM CLASS="term"
|
|
>forms</EM
|
|
></A
|
|
> in column three. In general, the exact <A HREF="26_1_Glossary.html#macro_expansion"
|
|
><EM CLASS="term"
|
|
>macro expansion</EM
|
|
></A
|
|
> of a <A HREF="f_setf.html" CLASS="macref"
|
|
><B
|
|
>setf</B
|
|
></A
|
|
> <A HREF="26_1_Glossary.html#form"
|
|
><EM CLASS="term"
|
|
>form</EM
|
|
></A
|
|
> is not guaranteed and can even be <A HREF="26_1_Glossary.html#implementation-dependent"
|
|
><EM CLASS="term"
|
|
>implementation-dependent</EM
|
|
></A
|
|
>; all that is guaranteed is that the expansion is an update form that works for that particular <A HREF="26_1_Glossary.html#implementation"
|
|
><EM CLASS="term"
|
|
>implementation</EM
|
|
></A
|
|
>, that the left-to-right evaluation of <A HREF="26_1_Glossary.html#subform"
|
|
><EM CLASS="term"
|
|
>subforms</EM
|
|
></A
|
|
> is preserved, and that the ultimate result of evaluating <A HREF="f_setf.html" CLASS="macref"
|
|
><B
|
|
>setf</B
|
|
></A
|
|
> is the value or values being stored.</P
|
|
><FIGURE CLASS="boxfig"
|
|
><DIV CLASS="figbody"
|
|
><TABLE CELLSPACING="0" CELLPADDING="0" RULES="GROUPS" STYLE="margin: 1ex 0" WIDTH="100%"
|
|
><THEAD
|
|
><TR
|
|
><TH ALIGN="LEFT" VALIGN="BASELINE" STYLE=";padding-right:3px"
|
|
><B
|
|
>Access function</B
|
|
></TH
|
|
><TH ALIGN="LEFT" VALIGN="BASELINE" STYLE="padding-left:3px;padding-right:3px"
|
|
> <B
|
|
>Update Function</B
|
|
></TH
|
|
><TH ALIGN="LEFT" VALIGN="BASELINE" STYLE="padding-left:3px;"
|
|
> <B
|
|
>Update using</B
|
|
> <A HREF="f_setf.html" CLASS="macref"
|
|
><B
|
|
>setf</B
|
|
></A
|
|
></TH
|
|
></TR
|
|
></THEAD
|
|
><TBODY
|
|
><TR
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" STYLE=";padding-right:3px"
|
|
> <CODE CLASS="f"
|
|
>x</CODE
|
|
></TD
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" STYLE="padding-left:3px;padding-right:3px"
|
|
> <CODE CLASS="f"
|
|
>(setq x datum)</CODE
|
|
></TD
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" STYLE="padding-left:3px;"
|
|
> <CODE CLASS="f"
|
|
>(setf x datum)</CODE
|
|
></TD
|
|
></TR
|
|
><TR
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" STYLE=";padding-right:3px"
|
|
> <CODE CLASS="f"
|
|
>(car x)</CODE
|
|
></TD
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" STYLE="padding-left:3px;padding-right:3px"
|
|
> <CODE CLASS="f"
|
|
>(rplaca x datum)</CODE
|
|
></TD
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" STYLE="padding-left:3px;"
|
|
> <CODE CLASS="f"
|
|
>(setf (car x) datum)</CODE
|
|
></TD
|
|
></TR
|
|
><TR
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" STYLE=";padding-right:3px"
|
|
> <CODE CLASS="f"
|
|
>(symbol-value x)</CODE
|
|
></TD
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" STYLE="padding-left:3px;padding-right:3px"
|
|
> <CODE CLASS="f"
|
|
>(set x datum)</CODE
|
|
></TD
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" STYLE="padding-left:3px;"
|
|
> <CODE CLASS="f"
|
|
>(setf (symbol-value x) datum)</CODE
|
|
></TD
|
|
></TR
|
|
></TBODY
|
|
></TABLE
|
|
></DIV
|
|
><FIGCAPTION CLASS="caption"
|
|
><B
|
|
>Figure 5–1. Examples of setf</B
|
|
></FIGCAPTION
|
|
></FIGURE
|
|
><P CLASS="j"
|
|
>Figure 5–2 shows <A HREF="26_1_Glossary.html#operator"
|
|
><EM CLASS="term"
|
|
>operators</EM
|
|
></A
|
|
> relating to <A HREF="26_1_Glossary.html#place"
|
|
><EM CLASS="term"
|
|
>places</EM
|
|
></A
|
|
> and <A HREF="26_1_Glossary.html#generalized_reference"
|
|
><EM CLASS="term"
|
|
>generalized reference</EM
|
|
></A
|
|
>.</P
|
|
><DIV CLASS="displaythree"
|
|
><FIGURE CLASS="boxfig"
|
|
><DIV CLASS="figbody"
|
|
><TABLE CELLSPACING="0" CELLPADDING="0" RULES="GROUPS" STYLE="margin: 1ex 0" WIDTH="100%"
|
|
><TBODY
|
|
><TR
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE=";padding-right:1em"
|
|
><A HREF="f_assert.html" CLASS="misc"
|
|
><B
|
|
>assert</B
|
|
></A
|
|
></TD
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;padding-right:1em"
|
|
> <A HREF="f_defsetf.html" CLASS="misc"
|
|
><B
|
|
>defsetf</B
|
|
></A
|
|
></TD
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;"
|
|
> <A HREF="f_push.html" CLASS="misc"
|
|
><B
|
|
>push</B
|
|
></A
|
|
></TD
|
|
></TR
|
|
><TR
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE=";padding-right:1em"
|
|
> <A HREF="f_case.html" CLASS="misc"
|
|
><B
|
|
>ccase</B
|
|
></A
|
|
></TD
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;padding-right:1em"
|
|
> <A HREF="f_get-setf-expansion.html" CLASS="misc"
|
|
><B
|
|
>get-setf-expansion</B
|
|
></A
|
|
></TD
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;"
|
|
> <A HREF="f_remf.html" CLASS="misc"
|
|
><B
|
|
>remf</B
|
|
></A
|
|
></TD
|
|
></TR
|
|
><TR
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE=";padding-right:1em"
|
|
> <A HREF="f_typecase.html" CLASS="misc"
|
|
><B
|
|
>ctypecase</B
|
|
></A
|
|
></TD
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;padding-right:1em"
|
|
> <A HREF="f_getf.html" CLASS="misc"
|
|
><B
|
|
>getf</B
|
|
></A
|
|
></TD
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;"
|
|
> <A HREF="f_rotatef.html" CLASS="misc"
|
|
><B
|
|
>rotatef</B
|
|
></A
|
|
></TD
|
|
></TR
|
|
><TR
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE=";padding-right:1em"
|
|
> <A HREF="f_incf.html" CLASS="misc"
|
|
><B
|
|
>decf</B
|
|
></A
|
|
></TD
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;padding-right:1em"
|
|
> <A HREF="f_incf.html" CLASS="misc"
|
|
><B
|
|
>incf</B
|
|
></A
|
|
></TD
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;"
|
|
> <A HREF="f_setf.html" CLASS="misc"
|
|
><B
|
|
>setf</B
|
|
></A
|
|
></TD
|
|
></TR
|
|
><TR
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE=";padding-right:1em"
|
|
> <A HREF="f_define-modify-macro.html" CLASS="misc"
|
|
><B
|
|
>define-modify-macro</B
|
|
></A
|
|
></TD
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;padding-right:1em"
|
|
> <A HREF="f_pop.html" CLASS="misc"
|
|
><B
|
|
>pop</B
|
|
></A
|
|
></TD
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;"
|
|
> <A HREF="f_shiftf.html" CLASS="misc"
|
|
><B
|
|
>shiftf</B
|
|
></A
|
|
></TD
|
|
></TR
|
|
><TR
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE=";padding-right:1em"
|
|
> <A HREF="f_define-setf-expander.html" CLASS="misc"
|
|
><B
|
|
>define-setf-expander</B
|
|
></A
|
|
></TD
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;padding-right:1em"
|
|
> <A HREF="f_setf.html" CLASS="misc"
|
|
><B
|
|
>psetf</B
|
|
></A
|
|
></TD
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;"
|
|
><SPAN CLASS="misc"
|
|
></SPAN
|
|
></TD
|
|
></TR
|
|
></TBODY
|
|
></TABLE
|
|
></DIV
|
|
><FIGCAPTION CLASS="caption"
|
|
><B
|
|
>Figure 5–2. Operators relating to places and generalized reference.</B
|
|
></FIGCAPTION
|
|
></FIGURE
|
|
></DIV
|
|
><P CLASS="j"
|
|
>Some of the <A HREF="26_1_Glossary.html#operator"
|
|
><EM CLASS="term"
|
|
>operators</EM
|
|
></A
|
|
> above manipulate <A HREF="26_1_Glossary.html#place"
|
|
><EM CLASS="term"
|
|
>places</EM
|
|
></A
|
|
> and some manipulate <A HREF="26_1_Glossary.html#setf_expander"
|
|
><EM CLASS="term"
|
|
>setf expanders</EM
|
|
></A
|
|
>. A <A HREF="26_1_Glossary.html#setf_expansion"
|
|
><EM CLASS="term"
|
|
>setf expansion</EM
|
|
></A
|
|
> can be derived from any <A HREF="26_1_Glossary.html#place"
|
|
><EM CLASS="term"
|
|
>place</EM
|
|
></A
|
|
>. New <A HREF="26_1_Glossary.html#setf_expander"
|
|
><EM CLASS="term"
|
|
>setf expanders</EM
|
|
></A
|
|
> can be defined by using <A HREF="f_defsetf.html" CLASS="macref"
|
|
><B
|
|
>defsetf</B
|
|
></A
|
|
> and <A HREF="f_define-setf-expander.html" CLASS="macref"
|
|
><B
|
|
>define-setf-expander</B
|
|
></A
|
|
>.</P
|
|
><H4 ID="sec_5_1_1_1" CLASS="HeadIV"
|
|
>5.1.1.1 Evaluation of Subforms to Places</H4
|
|
><P CLASS="j"
|
|
>The following rules apply to the <A HREF="26_1_Glossary.html#evaluation"
|
|
><EM CLASS="term"
|
|
>evaluation</EM
|
|
></A
|
|
> of <A HREF="26_1_Glossary.html#subform"
|
|
><EM CLASS="term"
|
|
>subforms</EM
|
|
></A
|
|
> in a <A HREF="26_1_Glossary.html#place"
|
|
><EM CLASS="term"
|
|
>place</EM
|
|
></A
|
|
>:</P
|
|
><OL
|
|
><LI
|
|
><P CLASS="j"
|
|
>The evaluation ordering of <A HREF="26_1_Glossary.html#subform"
|
|
><EM CLASS="term"
|
|
>subforms</EM
|
|
></A
|
|
> within a <A HREF="26_1_Glossary.html#place"
|
|
><EM CLASS="term"
|
|
>place</EM
|
|
></A
|
|
> is determined by the order specified by the second value returned by <A HREF="f_get-setf-expansion.html" CLASS="funref"
|
|
><B
|
|
>get-setf-expansion</B
|
|
></A
|
|
>. For all <A HREF="26_1_Glossary.html#place"
|
|
><EM CLASS="term"
|
|
>places</EM
|
|
></A
|
|
> defined by this specification (<I CLASS="i"
|
|
><I
|
|
>e.g.</I
|
|
></I
|
|
>, <A HREF="f_getf.html" CLASS="funref"
|
|
><B
|
|
>getf</B
|
|
></A
|
|
>, <A HREF="f_ldb.html" CLASS="funref"
|
|
><B
|
|
>ldb</B
|
|
></A
|
|
>, <I
|
|
>.</I
|
|
> <I
|
|
>.</I
|
|
> <I
|
|
>.</I
|
|
>), this order of evaluation is left-to-right. <SPAN CLASS="idx" DATA-KIND="idxtext" DATA-TERM="order of evaluation"
|
|
></SPAN
|
|
><SPAN CLASS="idx" DATA-KIND="idxtext" DATA-TERM="evaluation order"
|
|
></SPAN
|
|
>When a <A HREF="26_1_Glossary.html#place"
|
|
><EM CLASS="term"
|
|
>place</EM
|
|
></A
|
|
> is derived from a macro expansion, this rule is applied after the macro is expanded to find the appropriate <A HREF="26_1_Glossary.html#place"
|
|
><EM CLASS="term"
|
|
>place</EM
|
|
></A
|
|
>. </P
|
|
><P CLASS="j"
|
|
><A HREF="26_1_Glossary.html#place"
|
|
><EM CLASS="term"
|
|
>Places</EM
|
|
></A
|
|
> defined by using <A HREF="f_defmacro.html" CLASS="macref"
|
|
><B
|
|
>defmacro</B
|
|
></A
|
|
> or <A HREF="f_define-setf-expander.html" CLASS="macref"
|
|
><B
|
|
>define-setf-expander</B
|
|
></A
|
|
> use the evaluation order defined by those definitions. For example, consider the following:</P
|
|
><PRE CLASS="screen"
|
|
>(defmacro wrong-order (x y) `(getf ,y ,x))</PRE
|
|
><P CLASS="j"
|
|
>This following <A HREF="26_1_Glossary.html#form"
|
|
><EM CLASS="term"
|
|
>form</EM
|
|
></A
|
|
> evaluates <CODE CLASS="f"
|
|
>place2</CODE
|
|
> first and then <CODE CLASS="f"
|
|
>place1</CODE
|
|
> because that is the order they are evaluated in the macro expansion:</P
|
|
><PRE CLASS="screen"
|
|
>(push value (wrong-order place1 place2))</PRE
|
|
></LI
|
|
><LI
|
|
><P CLASS="j"
|
|
>For the <A HREF="26_1_Glossary.html#macro"
|
|
><EM CLASS="term"
|
|
>macros</EM
|
|
></A
|
|
> that manipulate <A HREF="26_1_Glossary.html#place"
|
|
><EM CLASS="term"
|
|
>places</EM
|
|
></A
|
|
> (<A HREF="f_push.html" CLASS="macref"
|
|
><B
|
|
>push</B
|
|
></A
|
|
>, <A HREF="f_pushnew.html" CLASS="macref"
|
|
><B
|
|
>pushnew</B
|
|
></A
|
|
>, <A HREF="f_remf.html" CLASS="macref"
|
|
><B
|
|
>remf</B
|
|
></A
|
|
>, <A HREF="f_incf.html" CLASS="macref"
|
|
><B
|
|
>incf</B
|
|
></A
|
|
>, <A HREF="f_incf.html" CLASS="macref"
|
|
><B
|
|
>decf</B
|
|
></A
|
|
>, <A HREF="f_shiftf.html" CLASS="macref"
|
|
><B
|
|
>shiftf</B
|
|
></A
|
|
>, <A HREF="f_rotatef.html" CLASS="macref"
|
|
><B
|
|
>rotatef</B
|
|
></A
|
|
>, <A HREF="f_setf.html" CLASS="macref"
|
|
><B
|
|
>psetf</B
|
|
></A
|
|
>, <A HREF="f_setf.html" CLASS="macref"
|
|
><B
|
|
>setf</B
|
|
></A
|
|
>, <A HREF="f_pop.html" CLASS="macref"
|
|
><B
|
|
>pop</B
|
|
></A
|
|
>, and those defined by <A HREF="f_define-modify-macro.html" CLASS="macref"
|
|
><B
|
|
>define-modify-macro</B
|
|
></A
|
|
>) the <A HREF="26_1_Glossary.html#subform"
|
|
><EM CLASS="term"
|
|
>subforms</EM
|
|
></A
|
|
> of the macro call are evaluated exactly once in left-to-right order, with the <A HREF="26_1_Glossary.html#subform"
|
|
><EM CLASS="term"
|
|
>subforms</EM
|
|
></A
|
|
> of the <A HREF="26_1_Glossary.html#place"
|
|
><EM CLASS="term"
|
|
>places</EM
|
|
></A
|
|
> evaluated in the order specified in (1). </P
|
|
><P CLASS="j"
|
|
><A HREF="f_push.html" CLASS="macref"
|
|
><B
|
|
>push</B
|
|
></A
|
|
>, <A HREF="f_pushnew.html" CLASS="macref"
|
|
><B
|
|
>pushnew</B
|
|
></A
|
|
>, <A HREF="f_remf.html" CLASS="macref"
|
|
><B
|
|
>remf</B
|
|
></A
|
|
>, <A HREF="f_incf.html" CLASS="macref"
|
|
><B
|
|
>incf</B
|
|
></A
|
|
>, <A HREF="f_incf.html" CLASS="macref"
|
|
><B
|
|
>decf</B
|
|
></A
|
|
>, <A HREF="f_shiftf.html" CLASS="macref"
|
|
><B
|
|
>shiftf</B
|
|
></A
|
|
>, <A HREF="f_rotatef.html" CLASS="macref"
|
|
><B
|
|
>rotatef</B
|
|
></A
|
|
>, <A HREF="f_setf.html" CLASS="macref"
|
|
><B
|
|
>psetf</B
|
|
></A
|
|
>, <A HREF="f_pop.html" CLASS="macref"
|
|
><B
|
|
>pop</B
|
|
></A
|
|
> evaluate all <A HREF="26_1_Glossary.html#subform"
|
|
><EM CLASS="term"
|
|
>subforms</EM
|
|
></A
|
|
> before modifying any of the <A HREF="26_1_Glossary.html#place"
|
|
><EM CLASS="term"
|
|
>place</EM
|
|
></A
|
|
> locations. <A HREF="f_setf.html" CLASS="macref"
|
|
><B
|
|
>setf</B
|
|
></A
|
|
> (in the case when <A HREF="f_setf.html" CLASS="macref"
|
|
><B
|
|
>setf</B
|
|
></A
|
|
> has more than two arguments) performs its operation on each pair in sequence. For example, in</P
|
|
><PRE CLASS="screen"
|
|
>(setf place1 value1 place2 value2 ...)</PRE
|
|
><P CLASS="j"
|
|
>the <A HREF="26_1_Glossary.html#subform"
|
|
><EM CLASS="term"
|
|
>subforms</EM
|
|
></A
|
|
> of <CODE CLASS="f"
|
|
>place1</CODE
|
|
> and <CODE CLASS="f"
|
|
>value1</CODE
|
|
> are evaluated, the location specified by <CODE CLASS="f"
|
|
>place1</CODE
|
|
> is modified to contain the value returned by <CODE CLASS="f"
|
|
>value1</CODE
|
|
>, and then the rest of the <A HREF="f_setf.html" CLASS="macref"
|
|
><B
|
|
>setf</B
|
|
></A
|
|
> form is processed in a like manner.</P
|
|
></LI
|
|
><LI
|
|
><P CLASS="j"
|
|
>For <A HREF="f_check-type.html" CLASS="macref"
|
|
><B
|
|
>check-type</B
|
|
></A
|
|
>, <A HREF="f_typecase.html" CLASS="macref"
|
|
><B
|
|
>ctypecase</B
|
|
></A
|
|
>, and <A HREF="f_case.html" CLASS="macref"
|
|
><B
|
|
>ccase</B
|
|
></A
|
|
>, <A HREF="26_1_Glossary.html#subform"
|
|
><EM CLASS="term"
|
|
>subforms</EM
|
|
></A
|
|
> of the <A HREF="26_1_Glossary.html#place"
|
|
><EM CLASS="term"
|
|
>place</EM
|
|
></A
|
|
> are evaluated once as in (1), but might be evaluated again if the type check fails in the case of <A HREF="f_check-type.html" CLASS="macref"
|
|
><B
|
|
>check-type</B
|
|
></A
|
|
> or none of the cases hold in <A HREF="f_typecase.html" CLASS="macref"
|
|
><B
|
|
>ctypecase</B
|
|
></A
|
|
> and <A HREF="f_case.html" CLASS="macref"
|
|
><B
|
|
>ccase</B
|
|
></A
|
|
>.</P
|
|
></LI
|
|
><LI
|
|
><P CLASS="j"
|
|
>For <A HREF="f_assert.html" CLASS="macref"
|
|
><B
|
|
>assert</B
|
|
></A
|
|
>, the order of evaluation of the generalized references is not specified.</P
|
|
></LI
|
|
></OL
|
|
><P CLASS="j"
|
|
><SPAN CLASS="idx" DATA-KIND="idxtext" DATA-TERM="order of evaluation"
|
|
></SPAN
|
|
><SPAN CLASS="idx" DATA-KIND="idxtext" DATA-TERM="evaluation order"
|
|
></SPAN
|
|
>Rules 2, 3 and 4 cover all <A HREF="26_1_Glossary.html#standardized"
|
|
><EM CLASS="term"
|
|
>standardized</EM
|
|
></A
|
|
> <A HREF="26_1_Glossary.html#macro"
|
|
><EM CLASS="term"
|
|
>macros</EM
|
|
></A
|
|
> that manipulate <A HREF="26_1_Glossary.html#place"
|
|
><EM CLASS="term"
|
|
>places</EM
|
|
></A
|
|
>.</P
|
|
><H5 ID="sec_5_1_1_1_1" CLASS="HeadV"
|
|
>5.1.1.1.1 Examples of Evaluation of Subforms to Places</H5
|
|
><PRE CLASS="screen"
|
|
> (let ((ref2 (list '())))
|
|
(push (progn (princ "1") 'ref-1)
|
|
(car (progn (princ "2") ref2))))
|
|
<SPAN CLASS="cmr"
|
|
>⊳</SPAN
|
|
> 12
|
|
<SPAN CLASS="cmsy"
|
|
><SPAN CLASS="arrow"
|
|
>→</SPAN
|
|
></SPAN
|
|
> (REF1)
|
|
|
|
(let (x)
|
|
(push (setq x (list 'a))
|
|
(car (setq x (list 'b))))
|
|
x)
|
|
<SPAN CLASS="cmsy"
|
|
><SPAN CLASS="arrow"
|
|
>→</SPAN
|
|
></SPAN
|
|
> (((A) . B))</PRE
|
|
><P CLASS="j"
|
|
><A HREF="f_push.html" CLASS="macref"
|
|
><B
|
|
>push</B
|
|
></A
|
|
> first evaluates <SPAN CLASS="cmtt"
|
|
>(setq</SPAN
|
|
> <SPAN CLASS="cmtt"
|
|
>x</SPAN
|
|
> <SPAN CLASS="cmtt"
|
|
>(list</SPAN
|
|
> <SPAN CLASS="cmtt"
|
|
>'a))</SPAN
|
|
> <SPAN CLASS="arrow"
|
|
>→</SPAN
|
|
> <SPAN CLASS="cmtt"
|
|
>(a)</SPAN
|
|
>, then evaluates <SPAN CLASS="cmtt"
|
|
>(setq</SPAN
|
|
> <SPAN CLASS="cmtt"
|
|
>x</SPAN
|
|
> <SPAN CLASS="cmtt"
|
|
>(list</SPAN
|
|
> <SPAN CLASS="cmtt"
|
|
>'b))</SPAN
|
|
> <SPAN CLASS="arrow"
|
|
>→</SPAN
|
|
> <SPAN CLASS="cmtt"
|
|
>(b)</SPAN
|
|
>, then modifies the <A HREF="26_1_Glossary.html#car"
|
|
><EM CLASS="term"
|
|
>car</EM
|
|
></A
|
|
> of this latest value to be <SPAN CLASS="cmtt"
|
|
>((a)</SPAN
|
|
> <SPAN CLASS="cmtt"
|
|
>.</SPAN
|
|
> <SPAN CLASS="cmtt"
|
|
>b)</SPAN
|
|
>.</P
|
|
><H4 ID="sec_5_1_1_2" CLASS="HeadIV"
|
|
>5.1.1.2 Setf Expansions</H4
|
|
><P CLASS="j"
|
|
>Sometimes it is possible to avoid evaluating <A HREF="26_1_Glossary.html#subform"
|
|
><EM CLASS="term"
|
|
>subforms</EM
|
|
></A
|
|
> of a <A HREF="26_1_Glossary.html#place"
|
|
><EM CLASS="term"
|
|
>place</EM
|
|
></A
|
|
> multiple times or in the wrong order. A <A HREF="26_1_Glossary.html#setf_expansion"
|
|
><EM CLASS="term"
|
|
>setf expansion</EM
|
|
></A
|
|
> for a given access form can be expressed as an ordered collection of five <A HREF="26_1_Glossary.html#object"
|
|
><EM CLASS="term"
|
|
>objects</EM
|
|
></A
|
|
>:</P
|
|
><DL
|
|
><DT
|
|
><B CLASS="b"
|
|
>List of temporary variables</B
|
|
></DT
|
|
><DD
|
|
><P CLASS="j"
|
|
>a list of symbols naming temporary variables to be bound sequentially, as if by <A HREF="f_let.html" CLASS="specref"
|
|
><B
|
|
>let*</B
|
|
></A
|
|
>, to <A HREF="26_1_Glossary.html#value"
|
|
><EM CLASS="term"
|
|
>values</EM
|
|
></A
|
|
> resulting from value forms.</P
|
|
></DD
|
|
><DT
|
|
><B CLASS="b"
|
|
>List of value forms</B
|
|
></DT
|
|
><DD
|
|
><P CLASS="j"
|
|
>a list of forms (typically, <A HREF="26_1_Glossary.html#subform"
|
|
><EM CLASS="term"
|
|
>subforms</EM
|
|
></A
|
|
> of the <A HREF="26_1_Glossary.html#place"
|
|
><EM CLASS="term"
|
|
>place</EM
|
|
></A
|
|
>) which when evaluated yield the values to which the corresponding temporary variables should be bound.</P
|
|
></DD
|
|
><DT
|
|
><B CLASS="b"
|
|
>List of store variables</B
|
|
></DT
|
|
><DD
|
|
><P CLASS="j"
|
|
>a list of symbols naming temporary store variables which are to hold the new values that will be assigned to the <A HREF="26_1_Glossary.html#place"
|
|
><EM CLASS="term"
|
|
>place</EM
|
|
></A
|
|
>.</P
|
|
></DD
|
|
><DT
|
|
><B CLASS="b"
|
|
>Storing form</B
|
|
></DT
|
|
><DD
|
|
><P CLASS="j"
|
|
>a form which can reference both the temporary and the store variables, and which changes the <A HREF="26_1_Glossary.html#value"
|
|
><EM CLASS="term"
|
|
>value</EM
|
|
></A
|
|
> of the <A HREF="26_1_Glossary.html#place"
|
|
><EM CLASS="term"
|
|
>place</EM
|
|
></A
|
|
> and guarantees to return as its values the values of the store variables, which are the correct values for <A HREF="f_setf.html" CLASS="macref"
|
|
><B
|
|
>setf</B
|
|
></A
|
|
> to return.</P
|
|
></DD
|
|
><DT
|
|
><B CLASS="b"
|
|
>Accessing form</B
|
|
></DT
|
|
><DD
|
|
><P CLASS="j"
|
|
>a <A HREF="26_1_Glossary.html#form"
|
|
><EM CLASS="term"
|
|
>form</EM
|
|
></A
|
|
> which can reference the temporary variables, and which returns the <A HREF="26_1_Glossary.html#value"
|
|
><EM CLASS="term"
|
|
>value</EM
|
|
></A
|
|
> of the <A HREF="26_1_Glossary.html#place"
|
|
><EM CLASS="term"
|
|
>place</EM
|
|
></A
|
|
>.</P
|
|
></DD
|
|
></DL
|
|
><P CLASS="j"
|
|
>The value returned by the accessing form is affected by execution of the storing form, but either of these forms might be evaluated any number of times. </P
|
|
><P CLASS="j"
|
|
>It is possible to do more than one <A HREF="f_setf.html" CLASS="macref"
|
|
><B
|
|
>setf</B
|
|
></A
|
|
> in parallel via <A HREF="f_setf.html" CLASS="macref"
|
|
><B
|
|
>psetf</B
|
|
></A
|
|
>, <A HREF="f_shiftf.html" CLASS="macref"
|
|
><B
|
|
>shiftf</B
|
|
></A
|
|
>, and <A HREF="f_rotatef.html" CLASS="macref"
|
|
><B
|
|
>rotatef</B
|
|
></A
|
|
>. Because of this, the <A HREF="26_1_Glossary.html#setf_expander"
|
|
><EM CLASS="term"
|
|
>setf expander</EM
|
|
></A
|
|
> must produce new temporary and store variable names every time. For examples of how to do this, see <A HREF="f_gensym.html" CLASS="funref"
|
|
><B
|
|
>gensym</B
|
|
></A
|
|
>. </P
|
|
><P CLASS="j"
|
|
>For each <A HREF="26_1_Glossary.html#standardized"
|
|
><EM CLASS="term"
|
|
>standardized</EM
|
|
></A
|
|
> accessor function <VAR CLASS="param"
|
|
>F</VAR
|
|
>, unless it is explicitly documented otherwise, it is <A HREF="26_1_Glossary.html#implementation-dependent"
|
|
><EM CLASS="term"
|
|
>implementation-dependent</EM
|
|
></A
|
|
> whether the ability to use an <VAR CLASS="param"
|
|
>F</VAR
|
|
> <A HREF="26_1_Glossary.html#form"
|
|
><EM CLASS="term"
|
|
>form</EM
|
|
></A
|
|
> as a <A HREF="f_setf.html" CLASS="macref"
|
|
><B
|
|
>setf</B
|
|
></A
|
|
> <A HREF="26_1_Glossary.html#place"
|
|
><EM CLASS="term"
|
|
>place</EM
|
|
></A
|
|
> is implemented by a <A HREF="26_1_Glossary.html#setf_expander"
|
|
><EM CLASS="term"
|
|
>setf expander</EM
|
|
></A
|
|
> or a <A HREF="26_1_Glossary.html#setf_function"
|
|
><EM CLASS="term"
|
|
>setf function</EM
|
|
></A
|
|
>. Also, it follows from this that it is <A HREF="26_1_Glossary.html#implementation-dependent"
|
|
><EM CLASS="term"
|
|
>implementation-dependent</EM
|
|
></A
|
|
> whether the name <CODE CLASS="f"
|
|
>(setf <VAR CLASS="param"
|
|
>F</VAR
|
|
>)</CODE
|
|
> is <A HREF="26_1_Glossary.html#fbound"
|
|
><EM CLASS="term"
|
|
>fbound</EM
|
|
></A
|
|
>.</P
|
|
><H5 ID="sec_5_1_1_2_1" CLASS="HeadV"
|
|
>5.1.1.2.1 Examples of Setf Expansions</H5
|
|
><P CLASS="j"
|
|
>Examples of the contents of the constituents of <A HREF="26_1_Glossary.html#setf_expansion"
|
|
><EM CLASS="term"
|
|
>setf expansions</EM
|
|
></A
|
|
> follow. </P
|
|
><P CLASS="j"
|
|
>For a variable <VAR CLASS="param"
|
|
>x</VAR
|
|
>:</P
|
|
><FIGURE CLASS="boxfig"
|
|
><DIV CLASS="figbody"
|
|
><TABLE CELLSPACING="0" CELLPADDING="0" RULES="GROUPS" STYLE="margin: 1ex 0" WIDTH="100%"
|
|
><TBODY
|
|
><TR
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" STYLE=";padding-right:3px"
|
|
><CODE CLASS="f"
|
|
>()</CODE
|
|
></TD
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" STYLE="padding-left:3px;"
|
|
> <SPAN CLASS="cmr"
|
|
>;list</SPAN
|
|
> <SPAN CLASS="cmr"
|
|
>of</SPAN
|
|
> <SPAN CLASS="cmr"
|
|
>temporary</SPAN
|
|
> <SPAN CLASS="cmr"
|
|
>variables</SPAN
|
|
></TD
|
|
></TR
|
|
><TR
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" STYLE=";padding-right:3px"
|
|
> <CODE CLASS="f"
|
|
>()</CODE
|
|
></TD
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" STYLE="padding-left:3px;"
|
|
> <SPAN CLASS="cmr"
|
|
>;list</SPAN
|
|
> <SPAN CLASS="cmr"
|
|
>of</SPAN
|
|
> <SPAN CLASS="cmr"
|
|
>value</SPAN
|
|
> <SPAN CLASS="cmr"
|
|
>forms</SPAN
|
|
></TD
|
|
></TR
|
|
><TR
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" STYLE=";padding-right:3px"
|
|
> <CODE CLASS="f"
|
|
>(g0001)</CODE
|
|
></TD
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" STYLE="padding-left:3px;"
|
|
> <SPAN CLASS="cmr"
|
|
>;list</SPAN
|
|
> <SPAN CLASS="cmr"
|
|
>of</SPAN
|
|
> <SPAN CLASS="cmr"
|
|
>store</SPAN
|
|
> <SPAN CLASS="cmr"
|
|
>variables</SPAN
|
|
></TD
|
|
></TR
|
|
><TR
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" STYLE=";padding-right:3px"
|
|
> <CODE CLASS="f"
|
|
>(setq <VAR CLASS="param"
|
|
>x</VAR
|
|
> g0001)</CODE
|
|
></TD
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" STYLE="padding-left:3px;"
|
|
> <SPAN CLASS="cmr"
|
|
>;storing</SPAN
|
|
> <SPAN CLASS="cmr"
|
|
>form</SPAN
|
|
></TD
|
|
></TR
|
|
><TR
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" STYLE=";padding-right:3px"
|
|
> <VAR CLASS="param"
|
|
>x</VAR
|
|
></TD
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" STYLE="padding-left:3px;"
|
|
> <SPAN CLASS="cmr"
|
|
>;accessing</SPAN
|
|
> <SPAN CLASS="cmr"
|
|
>form</SPAN
|
|
></TD
|
|
></TR
|
|
></TBODY
|
|
></TABLE
|
|
></DIV
|
|
><FIGCAPTION CLASS="caption"
|
|
><B
|
|
>Figure 5–3. Sample Setf Expansion of a Variable</B
|
|
></FIGCAPTION
|
|
></FIGURE
|
|
><P CLASS="j"
|
|
>For <SPAN CLASS="cmtt"
|
|
>(car</SPAN
|
|
> <VAR CLASS="param"
|
|
>exp</VAR
|
|
><SPAN CLASS="cmtt"
|
|
>)</SPAN
|
|
>:</P
|
|
><FIGURE CLASS="boxfig"
|
|
><DIV CLASS="figbody"
|
|
><TABLE CELLSPACING="0" CELLPADDING="0" RULES="GROUPS" STYLE="margin: 1ex 0" WIDTH="100%"
|
|
><TBODY
|
|
><TR
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" STYLE=";padding-right:3px"
|
|
><CODE CLASS="f"
|
|
>(g0002)</CODE
|
|
></TD
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" STYLE="padding-left:3px;"
|
|
> <SPAN CLASS="cmr"
|
|
>;list</SPAN
|
|
> <SPAN CLASS="cmr"
|
|
>of</SPAN
|
|
> <SPAN CLASS="cmr"
|
|
>temporary</SPAN
|
|
> <SPAN CLASS="cmr"
|
|
>variables</SPAN
|
|
></TD
|
|
></TR
|
|
><TR
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" STYLE=";padding-right:3px"
|
|
> <CODE CLASS="f"
|
|
>(<VAR CLASS="param"
|
|
>exp</VAR
|
|
>)</CODE
|
|
></TD
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" STYLE="padding-left:3px;"
|
|
> <SPAN CLASS="cmr"
|
|
>;list</SPAN
|
|
> <SPAN CLASS="cmr"
|
|
>of</SPAN
|
|
> <SPAN CLASS="cmr"
|
|
>value</SPAN
|
|
> <SPAN CLASS="cmr"
|
|
>forms</SPAN
|
|
></TD
|
|
></TR
|
|
><TR
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" STYLE=";padding-right:3px"
|
|
> <CODE CLASS="f"
|
|
>(g0003)</CODE
|
|
></TD
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" STYLE="padding-left:3px;"
|
|
> <SPAN CLASS="cmr"
|
|
>;list</SPAN
|
|
> <SPAN CLASS="cmr"
|
|
>of</SPAN
|
|
> <SPAN CLASS="cmr"
|
|
>store</SPAN
|
|
> <SPAN CLASS="cmr"
|
|
>variables</SPAN
|
|
></TD
|
|
></TR
|
|
><TR
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" STYLE=";padding-right:3px"
|
|
> <CODE CLASS="f"
|
|
>(progn (rplaca g0002 g0003) g0003)</CODE
|
|
></TD
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" STYLE="padding-left:3px;"
|
|
> <SPAN CLASS="cmr"
|
|
>;storing</SPAN
|
|
> <SPAN CLASS="cmr"
|
|
>form</SPAN
|
|
></TD
|
|
></TR
|
|
><TR
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" STYLE=";padding-right:3px"
|
|
> <CODE CLASS="f"
|
|
>(car g0002)</CODE
|
|
></TD
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" STYLE="padding-left:3px;"
|
|
> <SPAN CLASS="cmr"
|
|
>;accessing</SPAN
|
|
> <SPAN CLASS="cmr"
|
|
>form</SPAN
|
|
></TD
|
|
></TR
|
|
></TBODY
|
|
></TABLE
|
|
></DIV
|
|
><FIGCAPTION CLASS="caption"
|
|
><B
|
|
>Figure 5–4. Sample Setf Expansion of a CAR Form</B
|
|
></FIGCAPTION
|
|
></FIGURE
|
|
><P CLASS="j"
|
|
>For <CODE CLASS="f"
|
|
>(subseq <VAR CLASS="param"
|
|
>seq</VAR
|
|
> <VAR CLASS="param"
|
|
>s</VAR
|
|
> <VAR CLASS="param"
|
|
>e</VAR
|
|
>)</CODE
|
|
>:</P
|
|
><FIGURE CLASS="boxfig"
|
|
><DIV CLASS="figbody"
|
|
><TABLE CELLSPACING="0" CELLPADDING="0" RULES="GROUPS" STYLE="margin: 1ex 0" WIDTH="100%"
|
|
><TBODY
|
|
><TR
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" STYLE=";padding-right:3px"
|
|
><CODE CLASS="f"
|
|
>(g0004 g0005 g0006)</CODE
|
|
></TD
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" STYLE="padding-left:3px;"
|
|
> <SPAN CLASS="cmr"
|
|
>;list</SPAN
|
|
> <SPAN CLASS="cmr"
|
|
>of</SPAN
|
|
> <SPAN CLASS="cmr"
|
|
>temporary</SPAN
|
|
> <SPAN CLASS="cmr"
|
|
>variables</SPAN
|
|
></TD
|
|
></TR
|
|
><TR
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" STYLE=";padding-right:3px"
|
|
> <CODE CLASS="f"
|
|
>(<VAR CLASS="param"
|
|
>seq</VAR
|
|
> <VAR CLASS="param"
|
|
>s</VAR
|
|
> <VAR CLASS="param"
|
|
>e</VAR
|
|
>)</CODE
|
|
></TD
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" STYLE="padding-left:3px;"
|
|
> <SPAN CLASS="cmr"
|
|
>;list</SPAN
|
|
> <SPAN CLASS="cmr"
|
|
>of</SPAN
|
|
> <SPAN CLASS="cmr"
|
|
>value</SPAN
|
|
> <SPAN CLASS="cmr"
|
|
>forms</SPAN
|
|
></TD
|
|
></TR
|
|
><TR
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" STYLE=";padding-right:3px"
|
|
> <CODE CLASS="f"
|
|
>(g0007)</CODE
|
|
></TD
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" STYLE="padding-left:3px;"
|
|
> <SPAN CLASS="cmr"
|
|
>;list</SPAN
|
|
> <SPAN CLASS="cmr"
|
|
>of</SPAN
|
|
> <SPAN CLASS="cmr"
|
|
>store</SPAN
|
|
> <SPAN CLASS="cmr"
|
|
>variables</SPAN
|
|
></TD
|
|
></TR
|
|
><TR
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" COLSPAN="2" STYLE=";"
|
|
> <CODE CLASS="f"
|
|
>(progn (replace g0004 g0007 :start1 g0005 :end1 g0006) g0007)</CODE
|
|
></TD
|
|
></TR
|
|
><TR
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" STYLE=";padding-right:3px"
|
|
></TD
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" STYLE="padding-left:3px;"
|
|
> <SPAN CLASS="cmr"
|
|
>;storing</SPAN
|
|
> <SPAN CLASS="cmr"
|
|
>form</SPAN
|
|
></TD
|
|
></TR
|
|
><TR
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" STYLE=";padding-right:3px"
|
|
> <CODE CLASS="f"
|
|
>(subseq g0004 g0005 g0006)</CODE
|
|
></TD
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" STYLE="padding-left:3px;"
|
|
> <SPAN CLASS="cmr"
|
|
>;</SPAN
|
|
> <SPAN CLASS="cmr"
|
|
>accessing</SPAN
|
|
> <SPAN CLASS="cmr"
|
|
>form</SPAN
|
|
></TD
|
|
></TR
|
|
></TBODY
|
|
></TABLE
|
|
></DIV
|
|
><FIGCAPTION CLASS="caption"
|
|
><B
|
|
>Figure 5–5. Sample Setf Expansion of a SUBSEQ Form</B
|
|
></FIGCAPTION
|
|
></FIGURE
|
|
><P CLASS="j"
|
|
>In some cases, if a <A HREF="26_1_Glossary.html#subform"
|
|
><EM CLASS="term"
|
|
>subform</EM
|
|
></A
|
|
> of a <A HREF="26_1_Glossary.html#place"
|
|
><EM CLASS="term"
|
|
>place</EM
|
|
></A
|
|
> is itself a <A HREF="26_1_Glossary.html#place"
|
|
><EM CLASS="term"
|
|
>place</EM
|
|
></A
|
|
>, it is necessary to expand the <A HREF="26_1_Glossary.html#subform"
|
|
><EM CLASS="term"
|
|
>subform</EM
|
|
></A
|
|
> in order to compute some of the values in the expansion of the outer <A HREF="26_1_Glossary.html#place"
|
|
><EM CLASS="term"
|
|
>place</EM
|
|
></A
|
|
>. For <CODE CLASS="f"
|
|
>(ldb <VAR CLASS="param"
|
|
>bs</VAR
|
|
> (car <VAR CLASS="param"
|
|
>exp</VAR
|
|
>))</CODE
|
|
>:</P
|
|
><FIGURE CLASS="boxfig"
|
|
><DIV CLASS="figbody"
|
|
><TABLE CELLSPACING="0" CELLPADDING="0" RULES="GROUPS" STYLE="margin: 1ex 0" WIDTH="100%"
|
|
><TBODY
|
|
><TR
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" STYLE=";padding-right:3px"
|
|
><CODE CLASS="f"
|
|
>(g0001 g0002)</CODE
|
|
></TD
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" STYLE="padding-left:3px;"
|
|
> <SPAN CLASS="cmr"
|
|
>;list</SPAN
|
|
> <SPAN CLASS="cmr"
|
|
>of</SPAN
|
|
> <SPAN CLASS="cmr"
|
|
>temporary</SPAN
|
|
> <SPAN CLASS="cmr"
|
|
>variables</SPAN
|
|
></TD
|
|
></TR
|
|
><TR
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" STYLE=";padding-right:3px"
|
|
> <CODE CLASS="f"
|
|
>(<VAR CLASS="param"
|
|
>bs</VAR
|
|
> <VAR CLASS="param"
|
|
>exp</VAR
|
|
>)</CODE
|
|
></TD
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" STYLE="padding-left:3px;"
|
|
> <SPAN CLASS="cmr"
|
|
>;list</SPAN
|
|
> <SPAN CLASS="cmr"
|
|
>of</SPAN
|
|
> <SPAN CLASS="cmr"
|
|
>value</SPAN
|
|
> <SPAN CLASS="cmr"
|
|
>forms</SPAN
|
|
></TD
|
|
></TR
|
|
><TR
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" STYLE=";padding-right:3px"
|
|
> <CODE CLASS="f"
|
|
>(g0003)</CODE
|
|
></TD
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" STYLE="padding-left:3px;"
|
|
> <SPAN CLASS="cmr"
|
|
>;list</SPAN
|
|
> <SPAN CLASS="cmr"
|
|
>of</SPAN
|
|
> <SPAN CLASS="cmr"
|
|
>store</SPAN
|
|
> <SPAN CLASS="cmr"
|
|
>variables</SPAN
|
|
></TD
|
|
></TR
|
|
><TR
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" COLSPAN="2" STYLE=";"
|
|
> <CODE CLASS="f"
|
|
>(progn (rplaca g0002 (dpb g0003 g0001 (car g0002))) g0003)</CODE
|
|
></TD
|
|
></TR
|
|
><TR
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" STYLE=";padding-right:3px"
|
|
></TD
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" STYLE="padding-left:3px;"
|
|
> <SPAN CLASS="cmr"
|
|
>;storing</SPAN
|
|
> <SPAN CLASS="cmr"
|
|
>form</SPAN
|
|
></TD
|
|
></TR
|
|
><TR
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" STYLE=";padding-right:3px"
|
|
> <CODE CLASS="f"
|
|
>(ldb g0001 (car g0002))</CODE
|
|
></TD
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" STYLE="padding-left:3px;"
|
|
> <SPAN CLASS="cmr"
|
|
>;</SPAN
|
|
> <SPAN CLASS="cmr"
|
|
>accessing</SPAN
|
|
> <SPAN CLASS="cmr"
|
|
>form</SPAN
|
|
></TD
|
|
></TR
|
|
></TBODY
|
|
></TABLE
|
|
></DIV
|
|
><FIGCAPTION CLASS="caption"
|
|
><B
|
|
>Figure 5–6. Sample Setf Expansion of a LDB Form</B
|
|
></FIGCAPTION
|
|
></FIGURE
|
|
><H3 ID="sec_5_1_2" CLASS="HeadIII"
|
|
>5.1.2 Kinds of Places</H3
|
|
><P CLASS="j"
|
|
>Several kinds of <A HREF="26_1_Glossary.html#place"
|
|
><EM CLASS="term"
|
|
>places</EM
|
|
></A
|
|
> are defined by Common Lisp; this section enumerates them. This set can be extended by <A HREF="26_1_Glossary.html#implementation"
|
|
><EM CLASS="term"
|
|
>implementations</EM
|
|
></A
|
|
> and by <A HREF="26_1_Glossary.html#programmer_code"
|
|
><EM CLASS="term"
|
|
>programmer code</EM
|
|
></A
|
|
>.</P
|
|
><H4 ID="sec_5_1_2_1" CLASS="HeadIV"
|
|
>5.1.2.1 Variable Names as Places</H4
|
|
><P CLASS="j"
|
|
>The name of a <A HREF="26_1_Glossary.html#lexical_variable"
|
|
><EM CLASS="term"
|
|
>lexical variable</EM
|
|
></A
|
|
> or <A HREF="26_1_Glossary.html#dynamic_variable"
|
|
><EM CLASS="term"
|
|
>dynamic variable</EM
|
|
></A
|
|
> can be used as a <A HREF="26_1_Glossary.html#place"
|
|
><EM CLASS="term"
|
|
>place</EM
|
|
></A
|
|
>.</P
|
|
><H4 ID="sec_5_1_2_2" CLASS="HeadIV"
|
|
>5.1.2.2 Function Call Forms as Places</H4
|
|
><P CLASS="j"
|
|
>A <A HREF="26_1_Glossary.html#function_form"
|
|
><EM CLASS="term"
|
|
>function form</EM
|
|
></A
|
|
> can be used as a <A HREF="26_1_Glossary.html#place"
|
|
><EM CLASS="term"
|
|
>place</EM
|
|
></A
|
|
> if it falls into one of the following categories:</P
|
|
><UL
|
|
><LI
|
|
><P CLASS="j"
|
|
>A function call form whose first element is the name of any one of the functions in Figure 5–7.</P
|
|
><DIV CLASS="displaythree"
|
|
><FIGURE CLASS="boxfig"
|
|
><DIV CLASS="figbody"
|
|
><TABLE CELLSPACING="0" CELLPADDING="0" RULES="GROUPS" STYLE="margin: 1ex 0" WIDTH="100%"
|
|
><TBODY
|
|
><TR
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE=";padding-right:1em"
|
|
><A HREF="f_aref.html" CLASS="misc"
|
|
><B
|
|
>aref</B
|
|
></A
|
|
></TD
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;padding-right:1em"
|
|
> <A HREF="f_car.html" CLASS="misc"
|
|
><B
|
|
>cdadr</B
|
|
></A
|
|
></TD
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;"
|
|
> <A HREF="f_get.html" CLASS="misc"
|
|
><B
|
|
>get</B
|
|
></A
|
|
></TD
|
|
></TR
|
|
><TR
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE=";padding-right:1em"
|
|
> <A HREF="f_bit.html" CLASS="funref"
|
|
><B
|
|
>bit</B
|
|
></A
|
|
></TD
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;padding-right:1em"
|
|
> <A HREF="f_car.html" CLASS="misc"
|
|
><B
|
|
>cdar</B
|
|
></A
|
|
></TD
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;"
|
|
> <A HREF="f_gethash.html" CLASS="misc"
|
|
><B
|
|
>gethash</B
|
|
></A
|
|
></TD
|
|
></TR
|
|
><TR
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE=";padding-right:1em"
|
|
> <A HREF="f_car.html" CLASS="misc"
|
|
><B
|
|
>caaaar</B
|
|
></A
|
|
></TD
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;padding-right:1em"
|
|
> <A HREF="f_car.html" CLASS="misc"
|
|
><B
|
|
>cddaar</B
|
|
></A
|
|
></TD
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;"
|
|
> <A HREF="f_logical-pathname-translations.html" CLASS="misc"
|
|
><B
|
|
>logical-pathname-translations</B
|
|
></A
|
|
></TD
|
|
></TR
|
|
><TR
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE=";padding-right:1em"
|
|
> <A HREF="f_car.html" CLASS="misc"
|
|
><B
|
|
>caaadr</B
|
|
></A
|
|
></TD
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;padding-right:1em"
|
|
> <A HREF="f_car.html" CLASS="misc"
|
|
><B
|
|
>cddadr</B
|
|
></A
|
|
></TD
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;"
|
|
> <A HREF="f_macro-function.html" CLASS="misc"
|
|
><B
|
|
>macro-function</B
|
|
></A
|
|
></TD
|
|
></TR
|
|
><TR
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE=";padding-right:1em"
|
|
> <A HREF="f_car.html" CLASS="misc"
|
|
><B
|
|
>caaar</B
|
|
></A
|
|
></TD
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;padding-right:1em"
|
|
> <A HREF="f_car.html" CLASS="misc"
|
|
><B
|
|
>cddar</B
|
|
></A
|
|
></TD
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;"
|
|
> <A HREF="f_first.html" CLASS="misc"
|
|
><B
|
|
>ninth</B
|
|
></A
|
|
></TD
|
|
></TR
|
|
><TR
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE=";padding-right:1em"
|
|
> <A HREF="f_car.html" CLASS="misc"
|
|
><B
|
|
>caadar</B
|
|
></A
|
|
></TD
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;padding-right:1em"
|
|
> <A HREF="f_car.html" CLASS="misc"
|
|
><B
|
|
>cdddar</B
|
|
></A
|
|
></TD
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;"
|
|
> <A HREF="f_nth.html" CLASS="misc"
|
|
><B
|
|
>nth</B
|
|
></A
|
|
></TD
|
|
></TR
|
|
><TR
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE=";padding-right:1em"
|
|
> <A HREF="f_car.html" CLASS="misc"
|
|
><B
|
|
>caaddr</B
|
|
></A
|
|
></TD
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;padding-right:1em"
|
|
> <A HREF="f_car.html" CLASS="misc"
|
|
><B
|
|
>cddddr</B
|
|
></A
|
|
></TD
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;"
|
|
> <A HREF="f_readtable-case.html" CLASS="misc"
|
|
><B
|
|
>readtable-case</B
|
|
></A
|
|
></TD
|
|
></TR
|
|
><TR
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE=";padding-right:1em"
|
|
> <A HREF="f_car.html" CLASS="misc"
|
|
><B
|
|
>caadr</B
|
|
></A
|
|
></TD
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;padding-right:1em"
|
|
> <A HREF="f_car.html" CLASS="misc"
|
|
><B
|
|
>cdddr</B
|
|
></A
|
|
></TD
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;"
|
|
> <A HREF="f_rest.html" CLASS="misc"
|
|
><B
|
|
>rest</B
|
|
></A
|
|
></TD
|
|
></TR
|
|
><TR
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE=";padding-right:1em"
|
|
> <A HREF="f_car.html" CLASS="misc"
|
|
><B
|
|
>caar</B
|
|
></A
|
|
></TD
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;padding-right:1em"
|
|
> <A HREF="f_car.html" CLASS="misc"
|
|
><B
|
|
>cddr</B
|
|
></A
|
|
></TD
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;"
|
|
> <A HREF="f_row-major-aref.html" CLASS="misc"
|
|
><B
|
|
>row-major-aref</B
|
|
></A
|
|
></TD
|
|
></TR
|
|
><TR
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE=";padding-right:1em"
|
|
> <A HREF="f_car.html" CLASS="misc"
|
|
><B
|
|
>cadaar</B
|
|
></A
|
|
></TD
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;padding-right:1em"
|
|
> <A HREF="f_car.html" CLASS="misc"
|
|
><B
|
|
>cdr</B
|
|
></A
|
|
></TD
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;"
|
|
> <A HREF="f_bit.html" CLASS="misc"
|
|
><B
|
|
>sbit</B
|
|
></A
|
|
></TD
|
|
></TR
|
|
><TR
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE=";padding-right:1em"
|
|
> <A HREF="f_car.html" CLASS="misc"
|
|
><B
|
|
>cadadr</B
|
|
></A
|
|
></TD
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;padding-right:1em"
|
|
> <A HREF="f_char.html" CLASS="misc"
|
|
><B
|
|
>char</B
|
|
></A
|
|
></TD
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;"
|
|
> <A HREF="f_char.html" CLASS="misc"
|
|
><B
|
|
>schar</B
|
|
></A
|
|
></TD
|
|
></TR
|
|
><TR
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE=";padding-right:1em"
|
|
> <A HREF="f_car.html" CLASS="misc"
|
|
><B
|
|
>cadar</B
|
|
></A
|
|
></TD
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;padding-right:1em"
|
|
> <A HREF="f_class-name.html" CLASS="misc"
|
|
><B
|
|
>class-name</B
|
|
></A
|
|
></TD
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;"
|
|
> <A HREF="f_first.html" CLASS="misc"
|
|
><B
|
|
>second</B
|
|
></A
|
|
></TD
|
|
></TR
|
|
><TR
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE=";padding-right:1em"
|
|
> <A HREF="f_car.html" CLASS="misc"
|
|
><B
|
|
>caddar</B
|
|
></A
|
|
></TD
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;padding-right:1em"
|
|
> <A HREF="f_compiler-macro-function.html" CLASS="misc"
|
|
><B
|
|
>compiler-macro-function</B
|
|
></A
|
|
></TD
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;"
|
|
> <A HREF="f_first.html" CLASS="misc"
|
|
><B
|
|
>seventh</B
|
|
></A
|
|
></TD
|
|
></TR
|
|
><TR
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE=";padding-right:1em"
|
|
> <A HREF="f_car.html" CLASS="misc"
|
|
><B
|
|
>cadddr</B
|
|
></A
|
|
></TD
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;padding-right:1em"
|
|
> <A HREF="f_documentation.html" CLASS="misc"
|
|
><B
|
|
>documentation</B
|
|
></A
|
|
></TD
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;"
|
|
> <A HREF="f_first.html" CLASS="misc"
|
|
><B
|
|
>sixth</B
|
|
></A
|
|
></TD
|
|
></TR
|
|
><TR
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE=";padding-right:1em"
|
|
> <A HREF="f_car.html" CLASS="misc"
|
|
><B
|
|
>caddr</B
|
|
></A
|
|
></TD
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;padding-right:1em"
|
|
> <A HREF="f_first.html" CLASS="misc"
|
|
><B
|
|
>eighth</B
|
|
></A
|
|
></TD
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;"
|
|
> <A HREF="f_slot-value.html" CLASS="misc"
|
|
><B
|
|
>slot-value</B
|
|
></A
|
|
></TD
|
|
></TR
|
|
><TR
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE=";padding-right:1em"
|
|
> <A HREF="f_car.html" CLASS="misc"
|
|
><B
|
|
>cadr</B
|
|
></A
|
|
></TD
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;padding-right:1em"
|
|
> <A HREF="f_elt.html" CLASS="misc"
|
|
><B
|
|
>elt</B
|
|
></A
|
|
></TD
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;"
|
|
> <A HREF="f_subseq.html" CLASS="misc"
|
|
><B
|
|
>subseq</B
|
|
></A
|
|
></TD
|
|
></TR
|
|
><TR
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE=";padding-right:1em"
|
|
> <A HREF="f_car.html" CLASS="misc"
|
|
><B
|
|
>car</B
|
|
></A
|
|
></TD
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;padding-right:1em"
|
|
> <A HREF="f_fdefinition.html" CLASS="misc"
|
|
><B
|
|
>fdefinition</B
|
|
></A
|
|
></TD
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;"
|
|
> <A HREF="f_svref.html" CLASS="misc"
|
|
><B
|
|
>svref</B
|
|
></A
|
|
></TD
|
|
></TR
|
|
><TR
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE=";padding-right:1em"
|
|
> <A HREF="f_car.html" CLASS="misc"
|
|
><B
|
|
>cdaaar</B
|
|
></A
|
|
></TD
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;padding-right:1em"
|
|
> <A HREF="f_first.html" CLASS="misc"
|
|
><B
|
|
>fifth</B
|
|
></A
|
|
></TD
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;"
|
|
> <A HREF="f_symbol-function.html" CLASS="misc"
|
|
><B
|
|
>symbol-function</B
|
|
></A
|
|
></TD
|
|
></TR
|
|
><TR
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE=";padding-right:1em"
|
|
> <A HREF="f_car.html" CLASS="misc"
|
|
><B
|
|
>cdaadr</B
|
|
></A
|
|
></TD
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;padding-right:1em"
|
|
> <A HREF="f_fill-pointer.html" CLASS="misc"
|
|
><B
|
|
>fill-pointer</B
|
|
></A
|
|
></TD
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;"
|
|
> <A HREF="f_symbol-plist.html" CLASS="misc"
|
|
><B
|
|
>symbol-plist</B
|
|
></A
|
|
></TD
|
|
></TR
|
|
><TR
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE=";padding-right:1em"
|
|
> <A HREF="f_car.html" CLASS="misc"
|
|
><B
|
|
>cdaar</B
|
|
></A
|
|
></TD
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;padding-right:1em"
|
|
> <A HREF="f_find-class.html" CLASS="misc"
|
|
><B
|
|
>find-class</B
|
|
></A
|
|
></TD
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;"
|
|
> <A HREF="f_symbol-value.html" CLASS="misc"
|
|
><B
|
|
>symbol-value</B
|
|
></A
|
|
></TD
|
|
></TR
|
|
><TR
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE=";padding-right:1em"
|
|
> <A HREF="f_car.html" CLASS="misc"
|
|
><B
|
|
>cdadar</B
|
|
></A
|
|
></TD
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;padding-right:1em"
|
|
> <A HREF="f_first.html" CLASS="misc"
|
|
><B
|
|
>first</B
|
|
></A
|
|
></TD
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;"
|
|
> <A HREF="f_first.html" CLASS="misc"
|
|
><B
|
|
>tenth</B
|
|
></A
|
|
></TD
|
|
></TR
|
|
><TR
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE=";padding-right:1em"
|
|
> <A HREF="f_car.html" CLASS="misc"
|
|
><B
|
|
>cdaddr</B
|
|
></A
|
|
></TD
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;padding-right:1em"
|
|
> <A HREF="f_first.html" CLASS="misc"
|
|
><B
|
|
>fourth</B
|
|
></A
|
|
></TD
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;"
|
|
> <A HREF="f_first.html" CLASS="misc"
|
|
><B
|
|
>third</B
|
|
></A
|
|
></TD
|
|
></TR
|
|
></TBODY
|
|
></TABLE
|
|
></DIV
|
|
><FIGCAPTION CLASS="caption"
|
|
><B
|
|
>Figure 5–7. Functions that setf can be used with — 1</B
|
|
></FIGCAPTION
|
|
></FIGURE
|
|
></DIV
|
|
><P CLASS="j"
|
|
>In the case of <A HREF="f_subseq.html" CLASS="funref"
|
|
><B
|
|
>subseq</B
|
|
></A
|
|
>, the replacement value must be a <A HREF="26_1_Glossary.html#sequence"
|
|
><EM CLASS="term"
|
|
>sequence</EM
|
|
></A
|
|
> whose elements might be contained by the sequence argument to <A HREF="f_subseq.html" CLASS="funref"
|
|
><B
|
|
>subseq</B
|
|
></A
|
|
>, but does not have to be a <A HREF="26_1_Glossary.html#sequence"
|
|
><EM CLASS="term"
|
|
>sequence</EM
|
|
></A
|
|
> of the same <A HREF="26_1_Glossary.html#type"
|
|
><EM CLASS="term"
|
|
>type</EM
|
|
></A
|
|
> as the <A HREF="26_1_Glossary.html#sequence"
|
|
><EM CLASS="term"
|
|
>sequence</EM
|
|
></A
|
|
> of which the subsequence is specified. If the length of the replacement value does not equal the length of the subsequence to be replaced, then the shorter length determines the number of elements to be stored, as for <A HREF="f_replace.html" CLASS="funref"
|
|
><B
|
|
>replace</B
|
|
></A
|
|
>.</P
|
|
></LI
|
|
><LI
|
|
><P CLASS="j"
|
|
>A function call form whose first element is the name of a selector function constructed by <A HREF="f_defstruct.html" CLASS="macref"
|
|
><B
|
|
>defstruct</B
|
|
></A
|
|
>. The function name must refer to the global function definition, rather than a locally defined <A HREF="26_1_Glossary.html#function"
|
|
><EM CLASS="term"
|
|
>function</EM
|
|
></A
|
|
>.</P
|
|
></LI
|
|
><LI
|
|
><P CLASS="j"
|
|
>A function call form whose first element is the name of any one of the functions in Figure 5–8, provided that the supplied argument to that function is in turn a <A HREF="26_1_Glossary.html#place"
|
|
><EM CLASS="term"
|
|
>place</EM
|
|
></A
|
|
> form; in this case the new <A HREF="26_1_Glossary.html#place"
|
|
><EM CLASS="term"
|
|
>place</EM
|
|
></A
|
|
> has stored back into it the result of applying the supplied “update” function.</P
|
|
><FIGURE CLASS="boxfig"
|
|
><DIV CLASS="figbody"
|
|
><TABLE CELLSPACING="0" CELLPADDING="0" RULES="GROUPS" STYLE="margin: 1ex 0" WIDTH="100%"
|
|
><THEAD
|
|
><TR
|
|
><TH ALIGN="LEFT" VALIGN="BASELINE" STYLE=";padding-right:3px"
|
|
><B
|
|
>Function name</B
|
|
></TH
|
|
><TH ALIGN="LEFT" VALIGN="BASELINE" STYLE="padding-left:3px;padding-right:3px"
|
|
> <B
|
|
>Argument that is a</B
|
|
> <VAR CLASS="param"
|
|
>place</VAR
|
|
></TH
|
|
><TH ALIGN="LEFT" VALIGN="BASELINE" STYLE="padding-left:3px;"
|
|
> <B
|
|
>Update function used</B
|
|
></TH
|
|
></TR
|
|
></THEAD
|
|
><TBODY
|
|
><TR
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" STYLE=";padding-right:3px"
|
|
> <A HREF="f_ldb.html" CLASS="funref"
|
|
><B
|
|
>ldb</B
|
|
></A
|
|
></TD
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" STYLE="padding-left:3px;padding-right:3px"
|
|
> <SPAN CLASS="cmr"
|
|
>second</SPAN
|
|
></TD
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" STYLE="padding-left:3px;"
|
|
> <A HREF="f_dpb.html" CLASS="funref"
|
|
><B
|
|
>dpb</B
|
|
></A
|
|
></TD
|
|
></TR
|
|
><TR
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" STYLE=";padding-right:3px"
|
|
> <A HREF="f_mask-field.html" CLASS="funref"
|
|
><B
|
|
>mask-field</B
|
|
></A
|
|
></TD
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" STYLE="padding-left:3px;padding-right:3px"
|
|
> <SPAN CLASS="cmr"
|
|
>second</SPAN
|
|
></TD
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" STYLE="padding-left:3px;"
|
|
> <A HREF="f_deposit-field.html" CLASS="funref"
|
|
><B
|
|
>deposit-field</B
|
|
></A
|
|
></TD
|
|
></TR
|
|
><TR
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" STYLE=";padding-right:3px"
|
|
> <A HREF="f_getf.html" CLASS="funref"
|
|
><B
|
|
>getf</B
|
|
></A
|
|
></TD
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" STYLE="padding-left:3px;padding-right:3px"
|
|
> <SPAN CLASS="cmr"
|
|
>first</SPAN
|
|
></TD
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" STYLE="padding-left:3px;"
|
|
> <A HREF="26_1_Glossary.html#implementation-dependent"
|
|
><EM CLASS="term"
|
|
>implementation-dependent</EM
|
|
></A
|
|
></TD
|
|
></TR
|
|
></TBODY
|
|
></TABLE
|
|
></DIV
|
|
><FIGCAPTION CLASS="caption"
|
|
><B
|
|
>Figure 5–8. Functions that setf can be used with — 2</B
|
|
></FIGCAPTION
|
|
></FIGURE
|
|
><P CLASS="j"
|
|
>During the <A HREF="f_setf.html" CLASS="macref"
|
|
><B
|
|
>setf</B
|
|
></A
|
|
> expansion of these <A HREF="26_1_Glossary.html#form"
|
|
><EM CLASS="term"
|
|
>forms</EM
|
|
></A
|
|
>, it is necessary to call <A HREF="f_get-setf-expansion.html" CLASS="funref"
|
|
><B
|
|
>get-setf-expansion</B
|
|
></A
|
|
> in order to figure out how the inner, nested generalized variable must be treated. </P
|
|
><P CLASS="j"
|
|
>The information from <A HREF="f_get-setf-expansion.html" CLASS="funref"
|
|
><B
|
|
>get-setf-expansion</B
|
|
></A
|
|
> is used as follows.</P
|
|
><DL
|
|
><DT
|
|
><A HREF="f_ldb.html" CLASS="funref"
|
|
><B
|
|
>ldb</B
|
|
></A
|
|
></DT
|
|
><DD
|
|
><P CLASS="j"
|
|
>In a form such as: </P
|
|
><P CLASS="j"
|
|
><SPAN CLASS="cmtt"
|
|
>(setf</SPAN
|
|
> <SPAN CLASS="cmtt"
|
|
>(ldb</SPAN
|
|
> <VAR CLASS="param"
|
|
>byte-spec</VAR
|
|
> <VAR CLASS="param"
|
|
>place-form</VAR
|
|
><SPAN CLASS="cmtt"
|
|
>)</SPAN
|
|
> <VAR CLASS="param"
|
|
>value-form</VAR
|
|
><SPAN CLASS="cmtt"
|
|
>)</SPAN
|
|
> </P
|
|
><P CLASS="j"
|
|
>the place referred to by the <VAR CLASS="param"
|
|
>place-form</VAR
|
|
> must always be both <A HREF="26_1_Glossary.html#read"
|
|
><EM CLASS="term"
|
|
>read</EM
|
|
></A
|
|
> and <EM CLASS="term"
|
|
>written</EM
|
|
>; note that the update is to the generalized variable specified by <VAR CLASS="param"
|
|
>place-form</VAR
|
|
>, not to any object of <A HREF="26_1_Glossary.html#type"
|
|
><EM CLASS="term"
|
|
>type</EM
|
|
></A
|
|
> <A HREF="t_integer.html" CLASS="typeref"
|
|
><B
|
|
>integer</B
|
|
></A
|
|
>. </P
|
|
><P CLASS="j"
|
|
>Thus this <A HREF="f_setf.html" CLASS="macref"
|
|
><B
|
|
>setf</B
|
|
></A
|
|
> should generate code to do the following:</P
|
|
><OL
|
|
><LI
|
|
><P CLASS="j"
|
|
>Evaluate <VAR CLASS="param"
|
|
>byte-spec</VAR
|
|
> (and bind it into a temporary variable).</P
|
|
></LI
|
|
><LI
|
|
><P CLASS="j"
|
|
>Bind the temporary variables for <VAR CLASS="param"
|
|
>place-form</VAR
|
|
>.</P
|
|
></LI
|
|
><LI
|
|
><P CLASS="j"
|
|
>Evaluate <VAR CLASS="param"
|
|
>value-form</VAR
|
|
> (and bind its value or values into the store variable).</P
|
|
></LI
|
|
><LI
|
|
><P CLASS="j"
|
|
>Do the <A HREF="26_1_Glossary.html#read"
|
|
><EM CLASS="term"
|
|
>read</EM
|
|
></A
|
|
> from <VAR CLASS="param"
|
|
>place-form</VAR
|
|
>.</P
|
|
></LI
|
|
><LI
|
|
><P CLASS="j"
|
|
>Do the <A HREF="26_1_Glossary.html#write"
|
|
><EM CLASS="term"
|
|
>write</EM
|
|
></A
|
|
> into <VAR CLASS="param"
|
|
>place-form</VAR
|
|
> with the given bits of the <A HREF="26_1_Glossary.html#integer"
|
|
><EM CLASS="term"
|
|
>integer</EM
|
|
></A
|
|
> fetched in step 4 replaced with the value from step 3.</P
|
|
></LI
|
|
></OL
|
|
><P CLASS="j"
|
|
>If the evaluation of <VAR CLASS="param"
|
|
>value-form</VAR
|
|
> in step 3 alters what is found in <VAR CLASS="param"
|
|
>place-form</VAR
|
|
>, such as setting different bits of <A HREF="26_1_Glossary.html#integer"
|
|
><EM CLASS="term"
|
|
>integer</EM
|
|
></A
|
|
>, then the change of the bits denoted by <VAR CLASS="param"
|
|
>byte-spec</VAR
|
|
> is to that altered <A HREF="26_1_Glossary.html#integer"
|
|
><EM CLASS="term"
|
|
>integer</EM
|
|
></A
|
|
>, because step 4 is done after the <VAR CLASS="param"
|
|
>value-form</VAR
|
|
> evaluation. Nevertheless, the evaluations required for <A HREF="26_1_Glossary.html#binding"
|
|
><EM CLASS="term"
|
|
>binding</EM
|
|
></A
|
|
> the temporary variables are done in steps 1 and 2, and thus the expected left-to-right evaluation order is seen. For example:</P
|
|
><PRE CLASS="screen"
|
|
> (setq integer #x69) <SPAN CLASS="cmsy"
|
|
><SPAN CLASS="arrow"
|
|
>→</SPAN
|
|
></SPAN
|
|
> #x69
|
|
(rotatef (ldb (byte 4 4) integer)
|
|
(ldb (byte 4 0) integer))
|
|
integer <SPAN CLASS="cmsy"
|
|
><SPAN CLASS="arrow"
|
|
>→</SPAN
|
|
></SPAN
|
|
> #x96
|
|
;;; This example is trying to swap two independent bit fields
|
|
;;; in an integer. Note that the generalized variable of
|
|
;;; interest here is just the (possibly local) program variable
|
|
;;; integer.</PRE
|
|
></DD
|
|
><DT
|
|
><A HREF="f_mask-field.html" CLASS="funref"
|
|
><B
|
|
>mask-field</B
|
|
></A
|
|
></DT
|
|
><DD
|
|
><P CLASS="j"
|
|
>This case is the same as <A HREF="f_ldb.html" CLASS="funref"
|
|
><B
|
|
>ldb</B
|
|
></A
|
|
> in all essential aspects.</P
|
|
></DD
|
|
><DT
|
|
><A HREF="f_getf.html" CLASS="funref"
|
|
><B
|
|
>getf</B
|
|
></A
|
|
></DT
|
|
><DD
|
|
><P CLASS="j"
|
|
>In a form such as: </P
|
|
><P CLASS="j"
|
|
><CODE CLASS="f"
|
|
>(setf (getf <VAR CLASS="param"
|
|
>place-form</VAR
|
|
> <VAR CLASS="param"
|
|
>ind-form</VAR
|
|
>) <VAR CLASS="param"
|
|
>value-form</VAR
|
|
>)</CODE
|
|
> </P
|
|
><P CLASS="j"
|
|
>the place referred to by <VAR CLASS="param"
|
|
>place-form</VAR
|
|
> must always be both <A HREF="26_1_Glossary.html#read"
|
|
><EM CLASS="term"
|
|
>read</EM
|
|
></A
|
|
> and <EM CLASS="term"
|
|
>written</EM
|
|
>; note that the update is to the generalized variable specified by <VAR CLASS="param"
|
|
>place-form</VAR
|
|
>, not necessarily to the particular <A HREF="26_1_Glossary.html#list"
|
|
><EM CLASS="term"
|
|
>list</EM
|
|
></A
|
|
> that is the property list in question. </P
|
|
><P CLASS="j"
|
|
>Thus this <A HREF="f_setf.html" CLASS="macref"
|
|
><B
|
|
>setf</B
|
|
></A
|
|
> should generate code to do the following:</P
|
|
><OL
|
|
><LI
|
|
><P CLASS="j"
|
|
>Bind the temporary variables for <VAR CLASS="param"
|
|
>place-form</VAR
|
|
>.</P
|
|
></LI
|
|
><LI
|
|
><P CLASS="j"
|
|
>Evaluate <VAR CLASS="param"
|
|
>ind-form</VAR
|
|
> (and bind it into a temporary variable).</P
|
|
></LI
|
|
><LI
|
|
><P CLASS="j"
|
|
>Evaluate <VAR CLASS="param"
|
|
>value-form</VAR
|
|
> (and bind its value or values into the store variable).</P
|
|
></LI
|
|
><LI
|
|
><P CLASS="j"
|
|
>Do the <A HREF="26_1_Glossary.html#read"
|
|
><EM CLASS="term"
|
|
>read</EM
|
|
></A
|
|
> from <VAR CLASS="param"
|
|
>place-form</VAR
|
|
>.</P
|
|
></LI
|
|
><LI
|
|
><P CLASS="j"
|
|
>Do the <A HREF="26_1_Glossary.html#write"
|
|
><EM CLASS="term"
|
|
>write</EM
|
|
></A
|
|
> into <VAR CLASS="param"
|
|
>place-form</VAR
|
|
> with a possibly-new property list obtained by combining the values from steps 2, 3, and 4. (Note that the phrase “possibly-new property list” can mean that the former property list is somehow destructively re-used, or it can mean partial or full copying of it. Since either copying or destructive re-use can occur, the treatment of the resultant value for the possibly-new property list must proceed as if it were a different copy needing to be stored back into the generalized variable.)</P
|
|
></LI
|
|
></OL
|
|
><P CLASS="j"
|
|
>If the evaluation of <VAR CLASS="param"
|
|
>value-form</VAR
|
|
> in step 3 alters what is found in <VAR CLASS="param"
|
|
>place-form</VAR
|
|
>, such as setting a different named property in the list, then the change of the property denoted by <VAR CLASS="param"
|
|
>ind-form</VAR
|
|
> is to that altered list, because step 4 is done after the <VAR CLASS="param"
|
|
>value-form</VAR
|
|
> evaluation. Nevertheless, the evaluations required for <A HREF="26_1_Glossary.html#binding"
|
|
><EM CLASS="term"
|
|
>binding</EM
|
|
></A
|
|
> the temporary variables are done in steps 1 and 2, and thus the expected left-to-right evaluation order is seen. </P
|
|
><P CLASS="j"
|
|
>For example:</P
|
|
><PRE CLASS="screen"
|
|
> (setq s (setq r (list (list 'a 1 'b 2 'c 3)))) <SPAN CLASS="cmsy"
|
|
><SPAN CLASS="arrow"
|
|
>→</SPAN
|
|
></SPAN
|
|
> ((a 1 b 2 c 3))
|
|
(setf (getf (car r) 'b)
|
|
(progn (setq r nil) 6)) <SPAN CLASS="cmsy"
|
|
><SPAN CLASS="arrow"
|
|
>→</SPAN
|
|
></SPAN
|
|
> 6
|
|
r <SPAN CLASS="cmsy"
|
|
><SPAN CLASS="arrow"
|
|
>→</SPAN
|
|
></SPAN
|
|
> NIL
|
|
s <SPAN CLASS="cmsy"
|
|
><SPAN CLASS="arrow"
|
|
>→</SPAN
|
|
></SPAN
|
|
> ((A 1 B 6 C 3))
|
|
;;; Note that the (setq r nil) does not affect the actions of
|
|
;;; the SETF because the value of R had already been saved in
|
|
;;; a temporary variable as part of the step 1. Only the CAR
|
|
;;; of this value will be retrieved, and subsequently modified
|
|
;;; after the value computation.</PRE
|
|
></DD
|
|
></DL
|
|
></LI
|
|
></UL
|
|
><H4 ID="sec_5_1_2_3" CLASS="HeadIV"
|
|
>5.1.2.3 VALUES Forms as Places</H4
|
|
><P CLASS="j"
|
|
>A <A HREF="f_values.html" CLASS="funref"
|
|
><B
|
|
>values</B
|
|
></A
|
|
> <A HREF="26_1_Glossary.html#form"
|
|
><EM CLASS="term"
|
|
>form</EM
|
|
></A
|
|
> can be used as a <A HREF="26_1_Glossary.html#place"
|
|
><EM CLASS="term"
|
|
>place</EM
|
|
></A
|
|
>, provided that each of its <A HREF="26_1_Glossary.html#subform"
|
|
><EM CLASS="term"
|
|
>subforms</EM
|
|
></A
|
|
> is also a <A HREF="26_1_Glossary.html#place"
|
|
><EM CLASS="term"
|
|
>place</EM
|
|
></A
|
|
> form. </P
|
|
><P CLASS="j"
|
|
>A form such as </P
|
|
><P CLASS="j"
|
|
><SPAN CLASS="cmtt"
|
|
>(setf</SPAN
|
|
> <SPAN CLASS="cmtt"
|
|
>(values</SPAN
|
|
> <VAR CLASS="param"
|
|
>place-1</VAR
|
|
> <I
|
|
>.</I
|
|
> <I
|
|
>.</I
|
|
> <I
|
|
>.</I
|
|
> <VAR CLASS="param"
|
|
>place-n</VAR
|
|
><SPAN CLASS="cmtt"
|
|
>)</SPAN
|
|
> <VAR CLASS="param"
|
|
>values-form</VAR
|
|
><SPAN CLASS="cmtt"
|
|
>)</SPAN
|
|
> </P
|
|
><P CLASS="j"
|
|
>does the following:</P
|
|
><OL
|
|
><LI
|
|
><P CLASS="j"
|
|
>The <A HREF="26_1_Glossary.html#subform"
|
|
><EM CLASS="term"
|
|
>subforms</EM
|
|
></A
|
|
> of each nested <VAR CLASS="param"
|
|
>place</VAR
|
|
> are evaluated in left-to-right order.</P
|
|
></LI
|
|
><LI
|
|
><P CLASS="j"
|
|
>The <VAR CLASS="param"
|
|
>values-form</VAR
|
|
> is evaluated, and the first store variable from each <VAR CLASS="param"
|
|
>place</VAR
|
|
> is bound to its return values as if by <A HREF="f_multiple-value-bind.html" CLASS="macref"
|
|
><B
|
|
>multiple-value-bind</B
|
|
></A
|
|
>.</P
|
|
></LI
|
|
><LI
|
|
><P CLASS="j"
|
|
>If the <A HREF="26_1_Glossary.html#setf_expansion"
|
|
><EM CLASS="term"
|
|
>setf expansion</EM
|
|
></A
|
|
> for any <VAR CLASS="param"
|
|
>place</VAR
|
|
> involves more than one store variable, then the additional store variables are bound to <SPAN CLASS="misc"
|
|
><B
|
|
>nil</B
|
|
></SPAN
|
|
>.</P
|
|
></LI
|
|
><LI
|
|
><P CLASS="j"
|
|
>The storing forms for each <VAR CLASS="param"
|
|
>place</VAR
|
|
> are evaluated in left-to-right order.</P
|
|
></LI
|
|
></OL
|
|
><P CLASS="j"
|
|
>The storing form in the <A HREF="26_1_Glossary.html#setf_expansion"
|
|
><EM CLASS="term"
|
|
>setf expansion</EM
|
|
></A
|
|
> of <A HREF="f_values.html" CLASS="funref"
|
|
><B
|
|
>values</B
|
|
></A
|
|
> returns as <A HREF="26_1_Glossary.html#multiple_values"
|
|
><EM CLASS="term"
|
|
>multiple values</EM
|
|
></A
|
|
><SPAN CLASS="meaning"
|
|
><SUB CLASS="sub"
|
|
><SPAN CLASS="cmr"
|
|
>2</SPAN
|
|
></SUB
|
|
></SPAN
|
|
> the values of the store variables in step 2. That is, the number of values returned is the same as the number of <A HREF="26_1_Glossary.html#place"
|
|
><EM CLASS="term"
|
|
>place</EM
|
|
></A
|
|
> forms. This may be more or fewer values than are produced by the <VAR CLASS="param"
|
|
>values-form</VAR
|
|
>.</P
|
|
><H4 ID="sec_5_1_2_4" CLASS="HeadIV"
|
|
>5.1.2.4 THE Forms as Places</H4
|
|
><P CLASS="j"
|
|
>A <A HREF="f_the.html" CLASS="specref"
|
|
><B
|
|
>the</B
|
|
></A
|
|
> <A HREF="26_1_Glossary.html#form"
|
|
><EM CLASS="term"
|
|
>form</EM
|
|
></A
|
|
> can be used as a <A HREF="26_1_Glossary.html#place"
|
|
><EM CLASS="term"
|
|
>place</EM
|
|
></A
|
|
>, in which case the declaration is transferred to the <VAR CLASS="param"
|
|
>newvalue</VAR
|
|
> form, and the resulting <A HREF="f_setf.html" CLASS="macref"
|
|
><B
|
|
>setf</B
|
|
></A
|
|
> is analyzed. For example,</P
|
|
><PRE CLASS="screen"
|
|
>(setf (the integer (cadr x)) (+ y 3))</PRE
|
|
><P CLASS="j"
|
|
>is processed as if it were</P
|
|
><PRE CLASS="screen"
|
|
>(setf (cadr x) (the integer (+ y 3)))</PRE
|
|
><H4 ID="sec_5_1_2_5" CLASS="HeadIV"
|
|
>5.1.2.5 APPLY Forms as Places</H4
|
|
><P CLASS="j"
|
|
>The following situations involving <A HREF="f_setf.html" CLASS="macref"
|
|
><B
|
|
>setf</B
|
|
></A
|
|
> of <A HREF="f_apply.html" CLASS="funref"
|
|
><B
|
|
>apply</B
|
|
></A
|
|
> must be supported:</P
|
|
><UL
|
|
><LI
|
|
><P CLASS="j"
|
|
><CODE CLASS="f"
|
|
>(setf (apply #'aref <VAR CLASS="param"
|
|
>array</VAR
|
|
> <SPAN CLASS="cmsy"
|
|
>{</SPAN
|
|
><VAR CLASS="param"
|
|
>subscript</VAR
|
|
><SPAN CLASS="cmsy"
|
|
>}</SPAN
|
|
><SPAN CLASS="cmr"
|
|
>*</SPAN
|
|
> <VAR CLASS="param"
|
|
>more-subscripts</VAR
|
|
>) <VAR CLASS="param"
|
|
>new-element</VAR
|
|
>)</CODE
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P CLASS="j"
|
|
><CODE CLASS="f"
|
|
>(setf (apply #'bit <VAR CLASS="param"
|
|
>array</VAR
|
|
> <SPAN CLASS="cmsy"
|
|
>{</SPAN
|
|
><VAR CLASS="param"
|
|
>subscript</VAR
|
|
><SPAN CLASS="cmsy"
|
|
>}</SPAN
|
|
><SPAN CLASS="cmr"
|
|
>*</SPAN
|
|
> <VAR CLASS="param"
|
|
>more-subscripts</VAR
|
|
>) <VAR CLASS="param"
|
|
>new-element</VAR
|
|
>)</CODE
|
|
></P
|
|
></LI
|
|
><LI
|
|
><P CLASS="j"
|
|
><CODE CLASS="f"
|
|
>(setf (apply #'sbit <VAR CLASS="param"
|
|
>array</VAR
|
|
> <SPAN CLASS="cmsy"
|
|
>{</SPAN
|
|
><VAR CLASS="param"
|
|
>subscript</VAR
|
|
><SPAN CLASS="cmsy"
|
|
>}</SPAN
|
|
><SPAN CLASS="cmr"
|
|
>*</SPAN
|
|
> <VAR CLASS="param"
|
|
>more-subscripts</VAR
|
|
>) <VAR CLASS="param"
|
|
>new-element</VAR
|
|
>)</CODE
|
|
></P
|
|
></LI
|
|
></UL
|
|
><P CLASS="j"
|
|
>In all three cases, the <A HREF="26_1_Glossary.html#element"
|
|
><EM CLASS="term"
|
|
>element</EM
|
|
></A
|
|
> of <VAR CLASS="param"
|
|
>array</VAR
|
|
> designated by the concatenation of <VAR CLASS="param"
|
|
>subscripts</VAR
|
|
> and <VAR CLASS="param"
|
|
>more-subscripts</VAR
|
|
> (<I CLASS="i"
|
|
><I
|
|
>i.e.</I
|
|
></I
|
|
>, the same <A HREF="26_1_Glossary.html#element"
|
|
><EM CLASS="term"
|
|
>element</EM
|
|
></A
|
|
> which would be <A HREF="26_1_Glossary.html#read"
|
|
><EM CLASS="term"
|
|
>read</EM
|
|
></A
|
|
> by the call to <A HREF="26_1_Glossary.html#apply"
|
|
><EM CLASS="term"
|
|
>apply</EM
|
|
></A
|
|
> if it were not part of a <A HREF="f_setf.html" CLASS="macref"
|
|
><B
|
|
>setf</B
|
|
></A
|
|
> <A HREF="26_1_Glossary.html#form"
|
|
><EM CLASS="term"
|
|
>form</EM
|
|
></A
|
|
>) is changed to have the <A HREF="26_1_Glossary.html#value"
|
|
><EM CLASS="term"
|
|
>value</EM
|
|
></A
|
|
> given by <VAR CLASS="param"
|
|
>new-element</VAR
|
|
>. For these usages, the function name (<A HREF="f_aref.html" CLASS="funref"
|
|
><B
|
|
>aref</B
|
|
></A
|
|
>, <A HREF="f_bit.html" CLASS="funref"
|
|
><B
|
|
>bit</B
|
|
></A
|
|
>, or <A HREF="f_bit.html" CLASS="funref"
|
|
><B
|
|
>sbit</B
|
|
></A
|
|
>) must refer to the global function definition, rather than a locally defined <A HREF="26_1_Glossary.html#function"
|
|
><EM CLASS="term"
|
|
>function</EM
|
|
></A
|
|
>. </P
|
|
><P CLASS="j"
|
|
>No other <A HREF="26_1_Glossary.html#standardized"
|
|
><EM CLASS="term"
|
|
>standardized</EM
|
|
></A
|
|
> <A HREF="26_1_Glossary.html#function"
|
|
><EM CLASS="term"
|
|
>function</EM
|
|
></A
|
|
> is required to be supported, but an <A HREF="26_1_Glossary.html#implementation"
|
|
><EM CLASS="term"
|
|
>implementation</EM
|
|
></A
|
|
> may define such support. An <A HREF="26_1_Glossary.html#implementation"
|
|
><EM CLASS="term"
|
|
>implementation</EM
|
|
></A
|
|
> may also define support for <A HREF="26_1_Glossary.html#implementation-defined"
|
|
><EM CLASS="term"
|
|
>implementation-defined</EM
|
|
></A
|
|
> <A HREF="26_1_Glossary.html#operator"
|
|
><EM CLASS="term"
|
|
>operators</EM
|
|
></A
|
|
>. </P
|
|
><P CLASS="j"
|
|
>If a user-defined <A HREF="26_1_Glossary.html#function"
|
|
><EM CLASS="term"
|
|
>function</EM
|
|
></A
|
|
> is used in this context, the following equivalence is true, except that care is taken to preserve proper left-to-right evaluation of argument <A HREF="26_1_Glossary.html#subform"
|
|
><EM CLASS="term"
|
|
>subforms</EM
|
|
></A
|
|
>:</P
|
|
><PRE CLASS="screen"
|
|
>(setf (apply #'<VAR CLASS="param"
|
|
>name</VAR
|
|
> <SPAN CLASS="cmsy"
|
|
>{</SPAN
|
|
><VAR CLASS="param"
|
|
>arg</VAR
|
|
><SPAN CLASS="cmsy"
|
|
>}</SPAN
|
|
><SPAN CLASS="cmr"
|
|
>*</SPAN
|
|
>) <VAR CLASS="param"
|
|
>val</VAR
|
|
>)
|
|
<SPAN CLASS="cmsy"
|
|
><SPAN STYLE="font-size:16px;vertical-align:-2px"
|
|
>≡</SPAN
|
|
></SPAN
|
|
> (apply #'(setf <VAR CLASS="param"
|
|
>name</VAR
|
|
>) <VAR CLASS="param"
|
|
>val</VAR
|
|
> <SPAN CLASS="cmsy"
|
|
>{</SPAN
|
|
><VAR CLASS="param"
|
|
>arg</VAR
|
|
><SPAN CLASS="cmsy"
|
|
>}</SPAN
|
|
><SPAN CLASS="cmr"
|
|
>*</SPAN
|
|
>)</PRE
|
|
><H4 ID="sec_5_1_2_6" CLASS="HeadIV"
|
|
>5.1.2.6 Setf Expansions and Places</H4
|
|
><P CLASS="j"
|
|
>Any <A HREF="26_1_Glossary.html#compound_form"
|
|
><EM CLASS="term"
|
|
>compound form</EM
|
|
></A
|
|
> for which the <A HREF="26_1_Glossary.html#operator"
|
|
><EM CLASS="term"
|
|
>operator</EM
|
|
></A
|
|
> has a <A HREF="26_1_Glossary.html#setf_expander"
|
|
><EM CLASS="term"
|
|
>setf expander</EM
|
|
></A
|
|
> defined can be used as a <A HREF="26_1_Glossary.html#place"
|
|
><EM CLASS="term"
|
|
>place</EM
|
|
></A
|
|
>. The <A HREF="26_1_Glossary.html#operator"
|
|
><EM CLASS="term"
|
|
>operator</EM
|
|
></A
|
|
> must refer to the global function definition, rather than a locally defined <A HREF="26_1_Glossary.html#function"
|
|
><EM CLASS="term"
|
|
>function</EM
|
|
></A
|
|
> or <A HREF="26_1_Glossary.html#macro"
|
|
><EM CLASS="term"
|
|
>macro</EM
|
|
></A
|
|
>.</P
|
|
><H4 ID="sec_5_1_2_7" CLASS="HeadIV"
|
|
>5.1.2.7 Macro Forms as Places</H4
|
|
><P CLASS="j"
|
|
>A <A HREF="26_1_Glossary.html#macro_form"
|
|
><EM CLASS="term"
|
|
>macro form</EM
|
|
></A
|
|
> can be used as a <A HREF="26_1_Glossary.html#place"
|
|
><EM CLASS="term"
|
|
>place</EM
|
|
></A
|
|
>, in which case Common Lisp expands the <A HREF="26_1_Glossary.html#macro_form"
|
|
><EM CLASS="term"
|
|
>macro form</EM
|
|
></A
|
|
> as if by <A HREF="f_macroexpand.html" CLASS="funref"
|
|
><B
|
|
>macroexpand-1</B
|
|
></A
|
|
> and then uses the <A HREF="26_1_Glossary.html#macro_expansion"
|
|
><EM CLASS="term"
|
|
>macro expansion</EM
|
|
></A
|
|
> in place of the original <A HREF="26_1_Glossary.html#place"
|
|
><EM CLASS="term"
|
|
>place</EM
|
|
></A
|
|
>. Such <A HREF="26_1_Glossary.html#macro_expansion"
|
|
><EM CLASS="term"
|
|
>macro expansion</EM
|
|
></A
|
|
> is attempted only after exhausting all other possibilities other than expanding into a call to a function named <CODE CLASS="f"
|
|
>(setf <VAR CLASS="param"
|
|
>reader</VAR
|
|
>)</CODE
|
|
>.</P
|
|
><H4 ID="sec_5_1_2_8" CLASS="HeadIV"
|
|
>5.1.2.8 Symbol Macros as Places</H4
|
|
><P CLASS="j"
|
|
>A reference to a <A HREF="26_1_Glossary.html#symbol"
|
|
><EM CLASS="term"
|
|
>symbol</EM
|
|
></A
|
|
> that has been <A HREF="26_1_Glossary.html#establish"
|
|
><EM CLASS="term"
|
|
>established</EM
|
|
></A
|
|
> as a <A HREF="26_1_Glossary.html#symbol_macro"
|
|
><EM CLASS="term"
|
|
>symbol macro</EM
|
|
></A
|
|
> can be used as a <A HREF="26_1_Glossary.html#place"
|
|
><EM CLASS="term"
|
|
>place</EM
|
|
></A
|
|
>. In this case, <A HREF="f_setf.html" CLASS="macref"
|
|
><B
|
|
>setf</B
|
|
></A
|
|
> expands the reference and then analyzes the resulting <A HREF="26_1_Glossary.html#form"
|
|
><EM CLASS="term"
|
|
>form</EM
|
|
></A
|
|
>.</P
|
|
><H4 ID="sec_5_1_2_9" CLASS="HeadIV"
|
|
>5.1.2.9 Other Compound Forms as Places</H4
|
|
><P CLASS="j"
|
|
>For any other <A HREF="26_1_Glossary.html#compound_form"
|
|
><EM CLASS="term"
|
|
>compound form</EM
|
|
></A
|
|
> for which the <A HREF="26_1_Glossary.html#operator"
|
|
><EM CLASS="term"
|
|
>operator</EM
|
|
></A
|
|
> is a <A HREF="26_1_Glossary.html#symbol"
|
|
><EM CLASS="term"
|
|
>symbol</EM
|
|
></A
|
|
> <VAR CLASS="param"
|
|
>f</VAR
|
|
>, the <A HREF="f_setf.html" CLASS="macref"
|
|
><B
|
|
>setf</B
|
|
></A
|
|
> <A HREF="26_1_Glossary.html#form"
|
|
><EM CLASS="term"
|
|
>form</EM
|
|
></A
|
|
> expands into a call to the <A HREF="26_1_Glossary.html#function"
|
|
><EM CLASS="term"
|
|
>function</EM
|
|
></A
|
|
> named <CODE CLASS="f"
|
|
>(setf <VAR CLASS="param"
|
|
>f</VAR
|
|
>)</CODE
|
|
>. The first <A HREF="26_1_Glossary.html#argument"
|
|
><EM CLASS="term"
|
|
>argument</EM
|
|
></A
|
|
> in the newly constructed <A HREF="26_1_Glossary.html#function_form"
|
|
><EM CLASS="term"
|
|
>function form</EM
|
|
></A
|
|
> is <VAR CLASS="param"
|
|
>newvalue</VAR
|
|
> and the remaining <A HREF="26_1_Glossary.html#argument"
|
|
><EM CLASS="term"
|
|
>arguments</EM
|
|
></A
|
|
> are the remaining <A HREF="26_1_Glossary.html#element"
|
|
><EM CLASS="term"
|
|
>elements</EM
|
|
></A
|
|
> of <VAR CLASS="param"
|
|
>place</VAR
|
|
>. This expansion occurs regardless of whether <VAR CLASS="param"
|
|
>f</VAR
|
|
> or <CODE CLASS="f"
|
|
>(setf <VAR CLASS="param"
|
|
>f</VAR
|
|
>)</CODE
|
|
> is defined as a <A HREF="26_1_Glossary.html#function"
|
|
><EM CLASS="term"
|
|
>function</EM
|
|
></A
|
|
> locally, globally, or not at all. For example, </P
|
|
><P CLASS="j"
|
|
><CODE CLASS="f"
|
|
>(setf (<VAR CLASS="param"
|
|
>f</VAR
|
|
> <VAR CLASS="param"
|
|
>arg1</VAR
|
|
> <VAR CLASS="param"
|
|
>arg2</VAR
|
|
> ...) <VAR CLASS="param"
|
|
>new-value</VAR
|
|
>)</CODE
|
|
> </P
|
|
><P CLASS="j"
|
|
>expands into a form with the same effect and value as</P
|
|
><PRE CLASS="screen"
|
|
>(let ((#:temp-1 arg1) ;force correct order of evaluation
|
|
(#:temp-2 arg2)
|
|
...
|
|
(#:temp-0 <VAR CLASS="param"
|
|
>new-value</VAR
|
|
>))
|
|
(funcall (function (setf <VAR CLASS="param"
|
|
>f</VAR
|
|
>)) #:temp-0 #:temp-1 #:temp-2...))</PRE
|
|
><P CLASS="j"
|
|
>A <A HREF="26_1_Glossary.html#function"
|
|
><EM CLASS="term"
|
|
>function</EM
|
|
></A
|
|
> named <CODE CLASS="f"
|
|
>(setf <VAR CLASS="param"
|
|
>f</VAR
|
|
>)</CODE
|
|
> must return its first argument as its only value in order to preserve the semantics of <A HREF="f_setf.html" CLASS="macref"
|
|
><B
|
|
>setf</B
|
|
></A
|
|
>.</P
|
|
><H3 ID="sec_5_1_3" CLASS="HeadIII"
|
|
>5.1.3 Treatment of Other Macros Based on SETF</H3
|
|
><P CLASS="j"
|
|
>For each of the “read-modify-write” <A HREF="26_1_Glossary.html#operator"
|
|
><EM CLASS="term"
|
|
>operators</EM
|
|
></A
|
|
> in Figure 5–9, and for any additional <A HREF="26_1_Glossary.html#macro"
|
|
><EM CLASS="term"
|
|
>macros</EM
|
|
></A
|
|
> defined by the <A HREF="26_1_Glossary.html#programmer"
|
|
><EM CLASS="term"
|
|
>programmer</EM
|
|
></A
|
|
> using <A HREF="f_define-modify-macro.html" CLASS="macref"
|
|
><B
|
|
>define-modify-macro</B
|
|
></A
|
|
>, an exception is made to the normal rule of left-to-right evaluation of arguments. Evaluation of <A HREF="26_1_Glossary.html#argument"
|
|
><EM CLASS="term"
|
|
>argument</EM
|
|
></A
|
|
> <A HREF="26_1_Glossary.html#form"
|
|
><EM CLASS="term"
|
|
>forms</EM
|
|
></A
|
|
> occurs in left-to-right order, with the exception that for the <VAR CLASS="param"
|
|
>place</VAR
|
|
> <A HREF="26_1_Glossary.html#argument"
|
|
><EM CLASS="term"
|
|
>argument</EM
|
|
></A
|
|
>, the actual <A HREF="26_1_Glossary.html#read"
|
|
><EM CLASS="term"
|
|
>read</EM
|
|
></A
|
|
> of the “old value” from that <VAR CLASS="param"
|
|
>place</VAR
|
|
> happens after all of the <A HREF="26_1_Glossary.html#argument"
|
|
><EM CLASS="term"
|
|
>argument</EM
|
|
></A
|
|
> <A HREF="26_1_Glossary.html#form"
|
|
><EM CLASS="term"
|
|
>form</EM
|
|
></A
|
|
> <A HREF="26_1_Glossary.html#evaluation"
|
|
><EM CLASS="term"
|
|
>evaluations</EM
|
|
></A
|
|
>, and just before a “new value” is computed and <EM CLASS="term"
|
|
>written</EM
|
|
> back into the <VAR CLASS="param"
|
|
>place</VAR
|
|
>. </P
|
|
><P CLASS="j"
|
|
>Specifically, each of these <A HREF="26_1_Glossary.html#operator"
|
|
><EM CLASS="term"
|
|
>operators</EM
|
|
></A
|
|
> can be viewed as involving a <A HREF="26_1_Glossary.html#form"
|
|
><EM CLASS="term"
|
|
>form</EM
|
|
></A
|
|
> with the following general syntax:</P
|
|
><PRE CLASS="screen"
|
|
>(<A HREF="26_1_Glossary.html#operator"
|
|
><EM CLASS="term"
|
|
>operator</EM
|
|
></A
|
|
> <SPAN CLASS="cmsy"
|
|
>{</SPAN
|
|
><VAR CLASS="param"
|
|
>preceding-form</VAR
|
|
><SPAN CLASS="cmsy"
|
|
>}</SPAN
|
|
><SPAN CLASS="cmr"
|
|
>*</SPAN
|
|
> <VAR CLASS="param"
|
|
>place</VAR
|
|
> <SPAN CLASS="cmsy"
|
|
>{</SPAN
|
|
><VAR CLASS="param"
|
|
>following-form</VAR
|
|
><SPAN CLASS="cmsy"
|
|
>}</SPAN
|
|
><SPAN CLASS="cmr"
|
|
>*</SPAN
|
|
>)</PRE
|
|
><P CLASS="j"
|
|
>The evaluation of each such <A HREF="26_1_Glossary.html#form"
|
|
><EM CLASS="term"
|
|
>form</EM
|
|
></A
|
|
> proceeds like this:</P
|
|
><OL
|
|
><LI
|
|
><P CLASS="j"
|
|
><A HREF="26_1_Glossary.html#evaluate"
|
|
><EM CLASS="term"
|
|
>Evaluate</EM
|
|
></A
|
|
> each of the <VAR CLASS="param"
|
|
>preceding-forms</VAR
|
|
>, in left-to-right order.</P
|
|
></LI
|
|
><LI
|
|
><P CLASS="j"
|
|
><A HREF="26_1_Glossary.html#evaluate"
|
|
><EM CLASS="term"
|
|
>Evaluate</EM
|
|
></A
|
|
> the <A HREF="26_1_Glossary.html#subform"
|
|
><EM CLASS="term"
|
|
>subforms</EM
|
|
></A
|
|
> of the <VAR CLASS="param"
|
|
>place</VAR
|
|
>, in the order specified by the second value of the <A HREF="26_1_Glossary.html#setf_expansion"
|
|
><EM CLASS="term"
|
|
>setf expansion</EM
|
|
></A
|
|
> for that <VAR CLASS="param"
|
|
>place</VAR
|
|
>.</P
|
|
></LI
|
|
><LI
|
|
><P CLASS="j"
|
|
><A HREF="26_1_Glossary.html#evaluate"
|
|
><EM CLASS="term"
|
|
>Evaluate</EM
|
|
></A
|
|
> each of the <VAR CLASS="param"
|
|
>following-forms</VAR
|
|
>, in left-to-right order.</P
|
|
></LI
|
|
><LI
|
|
><P CLASS="j"
|
|
><A HREF="26_1_Glossary.html#read"
|
|
><EM CLASS="term"
|
|
>Read</EM
|
|
></A
|
|
> the old value from <VAR CLASS="param"
|
|
>place</VAR
|
|
>.</P
|
|
></LI
|
|
><LI
|
|
><P CLASS="j"
|
|
>Compute the new value.</P
|
|
></LI
|
|
><LI
|
|
><P CLASS="j"
|
|
>Store the new value into <VAR CLASS="param"
|
|
>place</VAR
|
|
>.</P
|
|
></LI
|
|
></OL
|
|
><DIV CLASS="displaythree"
|
|
><FIGURE CLASS="boxfig"
|
|
><DIV CLASS="figbody"
|
|
><TABLE CELLSPACING="0" CELLPADDING="0" RULES="GROUPS" STYLE="margin: 1ex 0" WIDTH="100%"
|
|
><TBODY
|
|
><TR
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE=";padding-right:1em"
|
|
><A HREF="f_incf.html" CLASS="misc"
|
|
><B
|
|
>decf</B
|
|
></A
|
|
></TD
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;padding-right:1em"
|
|
> <A HREF="f_pop.html" CLASS="misc"
|
|
><B
|
|
>pop</B
|
|
></A
|
|
></TD
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;"
|
|
> <A HREF="f_pushnew.html" CLASS="misc"
|
|
><B
|
|
>pushnew</B
|
|
></A
|
|
></TD
|
|
></TR
|
|
><TR
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE=";padding-right:1em"
|
|
> <A HREF="f_incf.html" CLASS="misc"
|
|
><B
|
|
>incf</B
|
|
></A
|
|
></TD
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;padding-right:1em"
|
|
> <A HREF="f_push.html" CLASS="misc"
|
|
><B
|
|
>push</B
|
|
></A
|
|
></TD
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;"
|
|
> <A HREF="f_remf.html" CLASS="misc"
|
|
><B
|
|
>remf</B
|
|
></A
|
|
></TD
|
|
></TR
|
|
></TBODY
|
|
></TABLE
|
|
></DIV
|
|
><FIGCAPTION CLASS="caption"
|
|
><B
|
|
>Figure 5–9. Read-Modify-Write Macros</B
|
|
></FIGCAPTION
|
|
></FIGURE
|
|
></DIV
|
|
></SECTION
|
|
></DIV
|
|
><DIV CLASS="footer"
|
|
><DIV CLASS="btmnav"
|
|
><A HREF="5_Data_and_Control_Flow.html" CLASS="prev"
|
|
>←</A
|
|
><A HREF="5_2_Transfer_of_Control_to_an_Exit_Point.html" CLASS="next"
|
|
>→</A
|
|
></DIV
|
|
><DIV CLASS="trail"
|
|
>Conversion to HTML copyright 2023 by Gilbert Baumann</DIV
|
|
></DIV
|
|
></DIV
|
|
><SCRIPT
|
|
>domReady();</SCRIPT
|
|
></BODY
|
|
></HTML
|
|
> |