summaryrefslogtreecommitdiff
path: root/devdocs/elisp/lambda-components.html
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2024-04-07 13:41:34 -0500
committerCraig Jennings <c@cjennings.net>2024-04-07 13:41:34 -0500
commit754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 (patch)
treef1190704f78f04a2b0b4c977d20fe96a828377f1 /devdocs/elisp/lambda-components.html
new repository
Diffstat (limited to 'devdocs/elisp/lambda-components.html')
-rw-r--r--devdocs/elisp/lambda-components.html12
1 files changed, 12 insertions, 0 deletions
diff --git a/devdocs/elisp/lambda-components.html b/devdocs/elisp/lambda-components.html
new file mode 100644
index 00000000..96e61fb2
--- /dev/null
+++ b/devdocs/elisp/lambda-components.html
@@ -0,0 +1,12 @@
+ <h4 class="subsection">Components of a Lambda Expression</h4> <p>A lambda expression is a list that looks like this: </p> <div class="example"> <pre class="example">(lambda (<var>arg-variables</var>…)
+ [<var>documentation-string</var>]
+ [<var>interactive-declaration</var>]
+ <var>body-forms</var>…)
+</pre>
+</div> <p>The first element of a lambda expression is always the symbol <code>lambda</code>. This indicates that the list represents a function. The reason functions are defined to start with <code>lambda</code> is so that other lists, intended for other uses, will not accidentally be valid as functions. </p> <p>The second element is a list of symbols—the argument variable names (see <a href="argument-list">Argument List</a>). This is called the <em>lambda list</em>. When a Lisp function is called, the argument values are matched up against the variables in the lambda list, which are given local bindings with the values provided. See <a href="local-variables">Local Variables</a>. </p> <p>The documentation string is a Lisp string object placed within the function definition to describe the function for the Emacs help facilities. See <a href="function-documentation">Function Documentation</a>. </p> <p>The interactive declaration is a list of the form <code>(interactive
+<var>code-string</var>)</code>. This declares how to provide arguments if the function is used interactively. Functions with this declaration are called <em>commands</em>; they can be called using <kbd>M-x</kbd> or bound to a key. Functions not intended to be called in this way should not have interactive declarations. See <a href="defining-commands">Defining Commands</a>, for how to write an interactive declaration. </p> <p>The rest of the elements are the <em>body</em> of the function: the Lisp code to do the work of the function (or, as a Lisp programmer would say, “a list of Lisp forms to evaluate”). The value returned by the function is the value returned by the last element of the body. </p><div class="_attribution">
+ <p class="_attribution-p">
+ Copyright &copy; 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-Components.html" class="_attribution-link">https://www.gnu.org/software/emacs/manual/html_node/elisp/Lambda-Components.html</a>
+ </p>
+</div>