| 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>Order of Execution (ANSI and GNU Common Lisp Document)</title> |
| 7 |
|
| 8 |
<meta name="description" content="Order of Execution (ANSI and GNU Common Lisp Document)"> |
| 9 |
<meta name="keywords" content="Order of Execution (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="Overview-of-the-Loop-Facility.html" rel="up" title="Overview of the Loop Facility"> |
| 15 |
<link href="Destructuring.html" rel="next" title="Destructuring"> |
| 16 |
<link href="Summary-of-Miscellaneous-Clauses.html" rel="prev" title="Summary of Miscellaneous Clauses"> |
| 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="Order-of-Execution"></span><div class="header"> |
| 41 |
<p> |
| 42 |
Next: <a href="Destructuring.html" accesskey="n" rel="next">Destructuring</a>, Previous: <a href="Summary-of-Miscellaneous-Clauses.html" accesskey="p" rel="prev">Summary of Miscellaneous Clauses</a>, Up: <a href="Overview-of-the-Loop-Facility.html" accesskey="u" rel="up">Overview of the Loop Facility</a> </p> |
| 43 |
</div> |
| 44 |
<hr> |
| 45 |
<span id="Order-of-Execution-1"></span><h4 class="subsubsection">6.1.1.14 Order of Execution</h4> |
| 46 |
|
| 47 |
<span id="index-order-of-evaluation-5"></span> |
| 48 |
|
| 49 |
<span id="index-evaluation-order-5"></span> |
| 50 |
|
| 51 |
<p>With the exceptions listed below, clauses are executed in the loop body |
| 52 |
in the order in which they appear in the source. Execution is repeated |
| 53 |
until a clause |
| 54 |
terminates the <b>loop</b> or until a <b>return</b>, <b>go</b>, |
| 55 |
or <b>throw</b> form is encountered |
| 56 |
which transfers control to a point outside of the loop. |
| 57 |
The following actions are |
| 58 |
exceptions to the linear order of execution: |
| 59 |
</p> |
| 60 |
<dl compact="compact"> |
| 61 |
<dt><tt>*</tt></dt> |
| 62 |
<dd><p>All variables are initialized first, |
| 63 |
regardless of where the establishing clauses appear in the |
| 64 |
source. The order of initialization follows the order of these clauses. |
| 65 |
</p> |
| 66 |
</dd> |
| 67 |
<dt><tt>*</tt></dt> |
| 68 |
<dd><p>The code for any <tt>initially</tt> clauses is collected |
| 69 |
into one <b>progn</b> in the order in which the clauses appear in |
| 70 |
the source. The collected code is executed once in the loop prologue |
| 71 |
after any implicit variable initializations. |
| 72 |
</p> |
| 73 |
</dd> |
| 74 |
<dt><tt>*</tt></dt> |
| 75 |
<dd><p>The code for any <tt>finally</tt> clauses is collected |
| 76 |
into one <b>progn</b> in the order in which the clauses appear in |
| 77 |
the source. The collected code is executed once in the loop epilogue |
| 78 |
before any implicit values from the accumulation clauses are returned. |
| 79 |
Explicit returns anywhere in the source, however, will exit the |
| 80 |
<b>loop</b> without executing the epilogue code. |
| 81 |
</p> |
| 82 |
</dd> |
| 83 |
<dt><tt>*</tt></dt> |
| 84 |
<dd><p>A <tt>with</tt> clause introduces a variable <i>binding</i> |
| 85 |
and an optional initial value. The initial values are calculated |
| 86 |
in the order in which the <tt>with</tt> clauses occur. |
| 87 |
</p> |
| 88 |
</dd> |
| 89 |
<dt><tt>*</tt></dt> |
| 90 |
<dd><p>Iteration control clauses implicitly perform the following actions: |
| 91 |
</p> |
| 92 |
<dl compact="compact"> |
| 93 |
<dt>–</dt> |
| 94 |
<dd><p>initialize variables; |
| 95 |
</p> |
| 96 |
</dd> |
| 97 |
<dt>–</dt> |
| 98 |
<dd><p><i>step</i> variables, generally |
| 99 |
between each execution of the loop body; |
| 100 |
</p> |
| 101 |
</dd> |
| 102 |
<dt>–</dt> |
| 103 |
<dd><p>perform termination tests, |
| 104 |
generally just before the execution of the |
| 105 |
loop body. |
| 106 |
</p> |
| 107 |
</dd> |
| 108 |
</dl> |
| 109 |
|
| 110 |
</dd> |
| 111 |
</dl> |
| 112 |
|
| 113 |
<hr> |
| 114 |
<div class="header"> |
| 115 |
<p> |
| 116 |
Next: <a href="Destructuring.html" accesskey="n" rel="next">Destructuring</a>, Previous: <a href="Summary-of-Miscellaneous-Clauses.html" accesskey="p" rel="prev">Summary of Miscellaneous Clauses</a>, Up: <a href="Overview-of-the-Loop-Facility.html" accesskey="u" rel="up">Overview of the Loop Facility</a> </p> |
| 117 |
</div> |
| 118 |
|
| 119 |
|
| 120 |
|
| 121 |
</body> |
| 122 |
</html> |