summaryrefslogtreecommitdiff
path: root/devdocs/elisp/sequencing.html
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2025-08-14 22:58:58 -0500
committerCraig Jennings <c@cjennings.net>2025-08-14 22:58:58 -0500
commit82ba818ff456bcd6d56a06226e3f27e98fbb55c3 (patch)
tree158cfc17b2f644a10f063cb546752cfaae12c97f /devdocs/elisp/sequencing.html
parent9278ddd4ea1a8b1a4c1edaa8894516e3f48d245b (diff)
downloaddotemacs-82ba818ff456bcd6d56a06226e3f27e98fbb55c3.tar.gz
dotemacs-82ba818ff456bcd6d56a06226e3f27e98fbb55c3.zip
removing all downloaded devdocs files
Diffstat (limited to 'devdocs/elisp/sequencing.html')
-rw-r--r--devdocs/elisp/sequencing.html43
1 files changed, 0 insertions, 43 deletions
diff --git a/devdocs/elisp/sequencing.html b/devdocs/elisp/sequencing.html
deleted file mode 100644
index f9a53d07..00000000
--- a/devdocs/elisp/sequencing.html
+++ /dev/null
@@ -1,43 +0,0 @@
- <h3 class="section">Sequencing</h3> <p>Evaluating forms in the order they appear is the most common way control passes from one form to another. In some contexts, such as in a function body, this happens automatically. Elsewhere you must use a control structure construct to do this: <code>progn</code>, the simplest control construct of Lisp. </p> <p>A <code>progn</code> special form looks like this: </p> <div class="example"> <pre class="example">(progn <var>a</var> <var>b</var> <var>c</var> …)
-</pre>
-</div> <p>and it says to execute the forms <var>a</var>, <var>b</var>, <var>c</var>, and so on, in that order. These forms are called the <em>body</em> of the <code>progn</code> form. The value of the last form in the body becomes the value of the entire <code>progn</code>. <code>(progn)</code> returns <code>nil</code>. </p> <p>In the early days of Lisp, <code>progn</code> was the only way to execute two or more forms in succession and use the value of the last of them. But programmers found they often needed to use a <code>progn</code> in the body of a function, where (at that time) only one form was allowed. So the body of a function was made into an implicit <code>progn</code>: several forms are allowed just as in the body of an actual <code>progn</code>. Many other control structures likewise contain an implicit <code>progn</code>. As a result, <code>progn</code> is not used as much as it was many years ago. It is needed now most often inside an <code>unwind-protect</code>, <code>and</code>, <code>or</code>, or in the <var>then</var>-part of an <code>if</code>. </p> <dl> <dt id="progn">Special Form: <strong>progn</strong> <em>forms…</em>
-</dt> <dd>
-<p>This special form evaluates all of the <var>forms</var>, in textual order, returning the result of the final form. </p> <div class="example"> <pre class="example">(progn (print "The first form")
- (print "The second form")
- (print "The third form"))
- -| "The first form"
- -| "The second form"
- -| "The third form"
-⇒ "The third form"
-</pre>
-</div> </dd>
-</dl> <p>Two other constructs likewise evaluate a series of forms but return different values: </p> <dl> <dt id="prog1">Special Form: <strong>prog1</strong> <em>form1 forms…</em>
-</dt> <dd>
-<p>This special form evaluates <var>form1</var> and all of the <var>forms</var>, in textual order, returning the result of <var>form1</var>. </p> <div class="example"> <pre class="example">(prog1 (print "The first form")
- (print "The second form")
- (print "The third form"))
- -| "The first form"
- -| "The second form"
- -| "The third form"
-⇒ "The first form"
-</pre>
-</div> <p>Here is a way to remove the first element from a list in the variable <code>x</code>, then return the value of that former element: </p> <div class="example"> <pre class="example">(prog1 (car x) (setq x (cdr x)))
-</pre>
-</div> </dd>
-</dl> <dl> <dt id="prog2">Special Form: <strong>prog2</strong> <em>form1 form2 forms…</em>
-</dt> <dd>
-<p>This special form evaluates <var>form1</var>, <var>form2</var>, and all of the following <var>forms</var>, in textual order, returning the result of <var>form2</var>. </p> <div class="example"> <pre class="example">(prog2 (print "The first form")
- (print "The second form")
- (print "The third form"))
- -| "The first form"
- -| "The second form"
- -| "The third form"
-⇒ "The second form"
-</pre>
-</div> </dd>
-</dl><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/Sequencing.html" class="_attribution-link">https://www.gnu.org/software/emacs/manual/html_node/elisp/Sequencing.html</a>
- </p>
-</div>