| 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>Generic Function Lambda Lists (ANSI and GNU Common Lisp Document)</title> |
| 7 |
|
| 8 |
<meta name="description" content="Generic Function Lambda Lists (ANSI and GNU Common Lisp Document)"> |
| 9 |
<meta name="keywords" content="Generic Function 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="Specialized-Lambda-Lists.html" rel="next" title="Specialized Lambda Lists"> |
| 16 |
<link href="Examples-of-Ordinary-Lambda-Lists.html" rel="prev" title="Examples of Ordinary 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="Generic-Function-Lambda-Lists"></span><div class="header"> |
| 41 |
<p> |
| 42 |
Next: <a href="Specialized-Lambda-Lists.html" accesskey="n" rel="next">Specialized Lambda Lists</a>, Previous: <a href="Ordinary-Lambda-Lists.html" accesskey="p" rel="prev">Ordinary Lambda Lists</a>, Up: <a href="Lambda-Lists.html" accesskey="u" rel="up">Lambda Lists</a> </p> |
| 43 |
</div> |
| 44 |
<hr> |
| 45 |
<span id="Generic-Function-Lambda-Lists-1"></span><h4 class="subsection">3.4.2 Generic Function Lambda Lists</h4> |
| 46 |
|
| 47 |
<p>A <i>generic function lambda list</i> |
| 48 |
<span id="index-generic-function-lambda-list"></span> |
| 49 |
is used to describe the overall shape of |
| 50 |
the argument list to be accepted by a <i>generic function</i>. |
| 51 |
Individual <i>method</i> <i>signatures</i> might contribute additional |
| 52 |
<i>keyword parameters</i> to the <i>lambda list</i> of the <i>effective method</i>. |
| 53 |
</p> |
| 54 |
<p>A <i>generic function lambda list</i> is used by <b>defgeneric</b>. |
| 55 |
</p> |
| 56 |
<p>A <i>generic function lambda list</i> has the following syntax: |
| 57 |
</p> |
| 58 |
<p><i><span class="nolinebreak">lambda-list</span></i> ::=<span class="roman">(</span>{<i>var</i>}*<!-- /@w --> |
| 59 |
<tt>[</tt><span class="roman">&optional</span> {<i>var</i> | <span class="roman">(</span><i>var</i><span class="roman">)</span>}*<tt>]</tt><!-- /@w --> |
| 60 |
<tt>[</tt><span class="roman">&rest</span> <i>var</i><tt>]</tt><!-- /@w --> |
| 61 |
<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>}* pt <span class="roman">[</span><tt><span class="nolinebreak">&allow-other-keys</span></tt><span class="roman">]</span><tt>]</tt><span class="roman">)</span><!-- /@w --> |
| 62 |
<!-- /@w --> |
| 63 |
</p> |
| 64 |
<p>A <i>generic function lambda list</i> can contain the <i>lambda list keywords</i> shown |
| 65 |
in Figure 3–14. |
| 66 |
</p> |
| 67 |
<div class="format"> |
| 68 |
<pre class="format"> <b>&allow-other-keys</b> <b>&optional</b> <!-- /@w --> |
| 69 |
<b>&key</b> <b>&rest</b> <!-- /@w --> |
| 70 |
|
| 71 |
Figure 3–14: Lambda List Keywords used by Generic Function Lambda Lists<!-- /@w --> |
| 72 |
|
| 73 |
</pre></div> |
| 74 |
|
| 75 |
<p>A <i>generic function lambda list</i> differs from an <i>ordinary lambda list</i> |
| 76 |
in the following ways: |
| 77 |
</p> |
| 78 |
<dl compact="compact"> |
| 79 |
<dt>Required arguments</dt> |
| 80 |
<dd><p>Zero or more <i>required parameters</i> must be specified. |
| 81 |
</p> |
| 82 |
</dd> |
| 83 |
<dt>Optional and keyword arguments</dt> |
| 84 |
<dd><p><i>Optional parameters</i> and <i>keyword parameters</i> may not have |
| 85 |
default initial value forms nor use supplied-p parameters. |
| 86 |
</p> |
| 87 |
</dd> |
| 88 |
<dt>Use of <b>&aux</b></dt> |
| 89 |
<dd><p>The use of <b>&aux</b> is not allowed. |
| 90 |
</p></dd> |
| 91 |
</dl> |
| 92 |
|
| 93 |
|
| 94 |
|
| 95 |
|
| 96 |
</body> |
| 97 |
</html> |