blob: 681f81ef0505f1f68046c5d3ee7c274cdd910be8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
<h3 class="section">Lambda Expressions</h3> <p>A lambda expression is a function object written in Lisp. Here is an example: </p> <div class="example"> <pre class="example">(lambda (x)
"Return the hyperbolic cosine of X."
(* 0.5 (+ (exp x) (exp (- x)))))
</pre>
</div> <p>In Emacs Lisp, such a list is a valid expression which evaluates to a function object. </p> <p>A lambda expression, by itself, has no name; it is an <em>anonymous function</em>. Although lambda expressions can be used this way (see <a href="anonymous-functions">Anonymous Functions</a>), they are more commonly associated with symbols to make <em>named functions</em> (see <a href="function-names">Function Names</a>). Before going into these details, the following subsections describe the components of a lambda expression and what they do. </p> <table class="menu" border="0" cellspacing="0"> <tr>
<td align="left" valign="top">• <a href="lambda-components" accesskey="1">Lambda Components</a>
</td>
<td> </td>
<td align="left" valign="top">The parts of a lambda expression. </td>
</tr> <tr>
<td align="left" valign="top">• <a href="simple-lambda" accesskey="2">Simple Lambda</a>
</td>
<td> </td>
<td align="left" valign="top">A simple example. </td>
</tr> <tr>
<td align="left" valign="top">• <a href="argument-list" accesskey="3">Argument List</a>
</td>
<td> </td>
<td align="left" valign="top">Details and special features of argument lists. </td>
</tr> <tr>
<td align="left" valign="top">• <a href="function-documentation" accesskey="4">Function Documentation</a>
</td>
<td> </td>
<td align="left" valign="top">How to put documentation in a function. </td>
</tr> </table><div class="_attribution">
<p class="_attribution-p">
Copyright © 1990-1996, 1998-2022 Free Software Foundation, Inc. <br>Licensed under the GNU GPL license.<br>
<a href="https://www.gnu.org/software/emacs/manual/html_node/elisp/Lambda-Expressions.html" class="_attribution-link">https://www.gnu.org/software/emacs/manual/html_node/elisp/Lambda-Expressions.html</a>
</p>
</div>
|