| 1 |
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
| 2 |
<html> |
| 3 |
<!-- Created by GNU Texinfo 6.7, http://www.gnu.org/software/texinfo/ --> |
| 4 |
<head> |
| 5 |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
| 6 |
<title>Ordinary Lambda Lists (ANSI and GNU Common Lisp Document)</title> |
| 7 |
|
| 8 |
<meta name="description" content="Ordinary Lambda Lists (ANSI and GNU Common Lisp Document)"> |
| 9 |
<meta name="keywords" content="Ordinary Lambda Lists (ANSI and GNU Common Lisp Document)"> |
| 10 |
<meta name="resource-type" content="document"> |
| 11 |
<meta name="distribution" content="global"> |
| 12 |
<meta name="Generator" content="makeinfo"> |
| 13 |
<link href="index.html" rel="start" title="Top"> |
| 14 |
<link href="Lambda-Lists.html" rel="up" title="Lambda Lists"> |
| 15 |
<link href="Specifiers-for-the-required-parameters.html" rel="next" title="Specifiers for the required parameters"> |
| 16 |
<link href="Lambda-Lists.html" rel="prev" title="Lambda Lists"> |
| 17 |
<style type="text/css"> |
| 18 |
<!-- |
| 19 |
a.summary-letter {text-decoration: none} |
| 20 |
blockquote.indentedblock {margin-right: 0em} |
| 21 |
div.display {margin-left: 3.2em} |
| 22 |
div.example {margin-left: 3.2em} |
| 23 |
div.lisp {margin-left: 3.2em} |
| 24 |
kbd {font-style: oblique} |
| 25 |
pre.display {font-family: inherit} |
| 26 |
pre.format {font-family: inherit} |
| 27 |
pre.menu-comment {font-family: serif} |
| 28 |
pre.menu-preformatted {font-family: serif} |
| 29 |
span.nolinebreak {white-space: nowrap} |
| 30 |
span.roman {font-family: initial; font-weight: normal} |
| 31 |
span.sansserif {font-family: sans-serif; font-weight: normal} |
| 32 |
ul.no-bullet {list-style: none} |
| 33 |
--> |
| 34 |
</style> |
| 35 |
|
| 36 |
|
| 37 |
</head> |
| 38 |
|
| 39 |
<body lang="en"> |
| 40 |
<span id="Ordinary-Lambda-Lists"></span><div class="header"> |
| 41 |
<p> |
| 42 |
Next: <a href="Generic-Function-Lambda-Lists.html" accesskey="n" rel="next">Generic Function Lambda Lists</a>, Previous: <a href="Lambda-Lists.html" accesskey="p" rel="prev">Lambda Lists</a>, Up: <a href="Lambda-Lists.html" accesskey="u" rel="up">Lambda Lists</a> </p> |
| 43 |
</div> |
| 44 |
<hr> |
| 45 |
<span id="Ordinary-Lambda-Lists-1"></span><h4 class="subsection">3.4.1 Ordinary Lambda Lists</h4> |
| 46 |
|
| 47 |
<p>An <i>ordinary lambda list</i> |
| 48 |
<span id="index-ordinary-lambda-list"></span> |
| 49 |
is used to describe how a set of |
| 50 |
<i>arguments</i> is received by an <i>ordinary</i> <i>function</i>. |
| 51 |
The <i>defined names</i> in Figure 3–12 are those which use |
| 52 |
<i>ordinary lambda lists</i>: |
| 53 |
</p> |
| 54 |
<div class="format"> |
| 55 |
<pre class="format"> define-method-combination handler-case restart-case <!-- /@w --> |
| 56 |
defun labels <!-- /@w --> |
| 57 |
flet lambda <!-- /@w --> |
| 58 |
|
| 59 |
Figure 3–12: Standardized Operators that use Ordinary Lambda Lists<!-- /@w --> |
| 60 |
|
| 61 |
</pre></div> |
| 62 |
|
| 63 |
<p>An <i>ordinary lambda list</i> can contain the <i>lambda list keywords</i> shown |
| 64 |
in Figure 3–13. |
| 65 |
</p> |
| 66 |
<div class="format"> |
| 67 |
<pre class="format"> <b>&allow-other-keys</b> <b>&key</b> <b>&rest</b> <!-- /@w --> |
| 68 |
<b>&aux</b> <b>&optional</b> <!-- /@w --> |
| 69 |
|
| 70 |
Figure 3–13: Lambda List Keywords used by Ordinary Lambda Lists<!-- /@w --> |
| 71 |
|
| 72 |
</pre></div> |
| 73 |
|
| 74 |
<p>Each <i>element</i> of a <i>lambda list</i> is either a parameter specifier |
| 75 |
or a <i>lambda list keyword</i>. |
| 76 |
Implementations are free to provide additional <i>lambda list keywords</i>. |
| 77 |
For a list of all <i>lambda list keywords</i> |
| 78 |
used by the implementation, see <b>lambda-list-keywords</b>. |
| 79 |
</p> |
| 80 |
<p>The syntax for <i>ordinary lambda lists</i> is as follows: |
| 81 |
</p> |
| 82 |
<p><i><span class="nolinebreak">lambda-list</span></i> ::=<span class="roman">(</span>{<i>var</i>}*<!-- /@w --> |
| 83 |
<tt>[</tt><span class="roman">&optional</span> {<i>var</i> | <span class="roman">(</span><i>var</i> <span class="roman">[</span><span class="nolinebreak">init-form</span> <span class="roman">[</span><span class="nolinebreak">supplied-p-parameter</span> <span class="roman">]</span><span class="roman">]</span><span class="roman">)</span>}*<tt>]</tt><!-- /@w --> |
| 84 |
<tt>[</tt><span class="roman">&rest</span> <i>var</i><tt>]</tt><!-- /@w --> |
| 85 |
<tt>[</tt><span class="roman">&key</span> {<i>var</i> | <span class="roman">(</span>{<i>var</i> | <span class="roman">(</span><i><span class="nolinebreak">keyword-name</span></i> <i>var</i><span class="roman">)</span>} <span class="roman">[</span><span class="nolinebreak">init-form</span> <span class="roman">[</span><span class="nolinebreak">supplied-p-parameter</span><span class="roman">]</span><span class="roman">]</span><span class="roman">)</span>}* pt <span class="roman">[</span><tt><span class="nolinebreak">&allow-other-keys</span></tt><span class="roman">]</span><tt>]</tt><!-- /@w --> |
| 86 |
<tt>[</tt><span class="roman">&aux</span> {<i>var</i> | <span class="roman">(</span><i>var</i> <span class="roman">[</span><i><span class="nolinebreak">init-form</span></i><span class="roman">]</span><span class="roman">)</span>}*<tt>]</tt><span class="roman">)</span><!-- /@w --> |
| 87 |
<!-- /@w --> |
| 88 |
</p> |
| 89 |
<p>A <i>var</i> or <i>supplied-p-parameter</i> must be a <i>symbol</i> |
| 90 |
that is not the name of a <i>constant variable</i>. |
| 91 |
</p> |
| 92 |
<p>An <i>init-form</i> can be any <i>form</i>. |
| 93 |
Whenever any <i>init-form</i> is evaluated for any parameter |
| 94 |
specifier, that <i>form</i> may refer to any parameter variable to |
| 95 |
the left of the specifier in which the <i>init-form</i> appears, |
| 96 |
including any <i>supplied-p-parameter</i> variables, and may rely |
| 97 |
on the fact that no other parameter variable has yet been bound |
| 98 |
(including its own parameter variable). |
| 99 |
</p> |
| 100 |
<p>A <i>keyword-name</i> can be any <i>symbol</i>, |
| 101 |
but by convention is normally a <i>keyword</i>_1; |
| 102 |
all <i>standardized</i> <i>functions</i> follow that convention. |
| 103 |
</p> |
| 104 |
<p>An <i>ordinary lambda list</i> has five parts, any or all of which may be empty. |
| 105 |
For information about the treatment of argument mismatches, |
| 106 |
see <a href="Error-Checking-in-Function-Calls.html">Error Checking in Function Calls</a>. |
| 107 |
</p> |
| 108 |
<table class="menu" border="0" cellspacing="0"> |
| 109 |
<tr><td align="left" valign="top">• <a href="Specifiers-for-the-required-parameters.html" accesskey="1">Specifiers for the required parameters</a></td><td> </td><td align="left" valign="top"> |
| 110 |
</td></tr> |
| 111 |
<tr><td align="left" valign="top">• <a href="Specifiers-for-optional-parameters.html" accesskey="2">Specifiers for optional parameters</a></td><td> </td><td align="left" valign="top"> |
| 112 |
</td></tr> |
| 113 |
<tr><td align="left" valign="top">• <a href="A-specifier-for-a-rest-parameter.html" accesskey="3">A specifier for a rest parameter</a></td><td> </td><td align="left" valign="top"> |
| 114 |
</td></tr> |
| 115 |
<tr><td align="left" valign="top">• <a href="Specifiers-for-keyword-parameters.html" accesskey="4">Specifiers for keyword parameters</a></td><td> </td><td align="left" valign="top"> |
| 116 |
</td></tr> |
| 117 |
<tr><td align="left" valign="top">• <a href="Suppressing-Keyword-Argument-Checking.html" accesskey="5">Suppressing Keyword Argument Checking</a></td><td> </td><td align="left" valign="top"> |
| 118 |
</td></tr> |
| 119 |
<tr><td align="left" valign="top">• <a href="Examples-of-Suppressing-Keyword-Argument-Checking.html" accesskey="6">Examples of Suppressing Keyword Argument Checking</a></td><td> </td><td align="left" valign="top"> |
| 120 |
</td></tr> |
| 121 |
<tr><td align="left" valign="top">• <a href="Specifiers-for-_0026aux-variables.html" accesskey="7">Specifiers for <b>&aux</b> variables</a></td><td> </td><td align="left" valign="top"> |
| 122 |
</td></tr> |
| 123 |
<tr><td align="left" valign="top">• <a href="Examples-of-Ordinary-Lambda-Lists.html" accesskey="8">Examples of Ordinary Lambda Lists</a></td><td> </td><td align="left" valign="top"> |
| 124 |
</td></tr> |
| 125 |
</table> |
| 126 |
|
| 127 |
<hr> |
| 128 |
<div class="header"> |
| 129 |
<p> |
| 130 |
Next: <a href="Generic-Function-Lambda-Lists.html" accesskey="n" rel="next">Generic Function Lambda Lists</a>, Previous: <a href="Lambda-Lists.html" accesskey="p" rel="prev">Lambda Lists</a>, Up: <a href="Lambda-Lists.html" accesskey="u" rel="up">Lambda Lists</a> </p> |
| 131 |
</div> |
| 132 |
|
| 133 |
|
| 134 |
|
| 135 |
</body> |
| 136 |
</html> |