diff options
| author | Richard M. Stallman | 2005-02-14 10:07:43 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2005-02-14 10:07:43 +0000 |
| commit | 85831f9a60cca17cfe2fc201667c599091e9cc50 (patch) | |
| tree | 7eb9ffcd381c2cd310901fda89bc93542ce6fafb | |
| parent | b57bdd74720b691421e35d705324d1e5834371e4 (diff) | |
| download | emacs-85831f9a60cca17cfe2fc201667c599091e9cc50.tar.gz emacs-85831f9a60cca17cfe2fc201667c599091e9cc50.zip | |
(Combining Conditions): Wording cleanup.
(Iteration): dolist and dotimes bind VAR locally.
(Cleanups): Xref to Atomic Changes.
| -rw-r--r-- | lispref/control.texi | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/lispref/control.texi b/lispref/control.texi index e2a1e26b170..760e7bb82de 100644 --- a/lispref/control.texi +++ b/lispref/control.texi | |||
| @@ -346,8 +346,8 @@ Here is a more realistic example of using @code{and}: | |||
| 346 | Note that @code{(car foo)} is not executed if @code{(consp foo)} returns | 346 | Note that @code{(car foo)} is not executed if @code{(consp foo)} returns |
| 347 | @code{nil}, thus avoiding an error. | 347 | @code{nil}, thus avoiding an error. |
| 348 | 348 | ||
| 349 | @code{and} can be expressed in terms of either @code{if} or @code{cond}. | 349 | @code{and} expressions can also be written using either @code{if} or |
| 350 | For example: | 350 | @code{cond}. Here's how: |
| 351 | 351 | ||
| 352 | @example | 352 | @example |
| 353 | @group | 353 | @group |
| @@ -476,11 +476,11 @@ write two common kinds of loops. | |||
| 476 | 476 | ||
| 477 | @defmac dolist (var list [result]) body@dots{} | 477 | @defmac dolist (var list [result]) body@dots{} |
| 478 | @tindex dolist | 478 | @tindex dolist |
| 479 | This construct executes @var{body} once for each element of @var{list}, | 479 | This construct executes @var{body} once for each element of |
| 480 | using the variable @var{var} to hold the current element. Then it | 480 | @var{list}, binding the variable @var{var} locally to hold the current |
| 481 | returns the value of evaluating @var{result}, or @code{nil} if | 481 | element. Then it returns the value of evaluating @var{result}, or |
| 482 | @var{result} is omitted. For example, here is how you could use | 482 | @code{nil} if @var{result} is omitted. For example, here is how you |
| 483 | @code{dolist} to define the @code{reverse} function: | 483 | could use @code{dolist} to define the @code{reverse} function: |
| 484 | 484 | ||
| 485 | @example | 485 | @example |
| 486 | (defun reverse (list) | 486 | (defun reverse (list) |
| @@ -493,8 +493,8 @@ returns the value of evaluating @var{result}, or @code{nil} if | |||
| 493 | @defmac dotimes (var count [result]) body@dots{} | 493 | @defmac dotimes (var count [result]) body@dots{} |
| 494 | @tindex dotimes | 494 | @tindex dotimes |
| 495 | This construct executes @var{body} once for each integer from 0 | 495 | This construct executes @var{body} once for each integer from 0 |
| 496 | (inclusive) to @var{count} (exclusive), using the variable @var{var} to | 496 | (inclusive) to @var{count} (exclusive), binding the variable @var{var} |
| 497 | hold the integer for the current iteration. Then it returns the value | 497 | to the integer for the current iteration. Then it returns the value |
| 498 | of evaluating @var{result}, or @code{nil} if @var{result} is omitted. | 498 | of evaluating @var{result}, or @code{nil} if @var{result} is omitted. |
| 499 | Here is an example of using @code{dotimes} to do something 100 times: | 499 | Here is an example of using @code{dotimes} to do something 100 times: |
| 500 | 500 | ||
| @@ -1167,7 +1167,10 @@ and their conditions. | |||
| 1167 | 1167 | ||
| 1168 | The @code{unwind-protect} construct is essential whenever you | 1168 | The @code{unwind-protect} construct is essential whenever you |
| 1169 | temporarily put a data structure in an inconsistent state; it permits | 1169 | temporarily put a data structure in an inconsistent state; it permits |
| 1170 | you to make the data consistent again in the event of an error or throw. | 1170 | you to make the data consistent again in the event of an error or |
| 1171 | throw. (Another more specific cleanup construct that is used only for | ||
| 1172 | changes in buffer contents is the atomic change group; @ref{Atomic | ||
| 1173 | Changes}.) | ||
| 1171 | 1174 | ||
| 1172 | @defspec unwind-protect body-form cleanup-forms@dots{} | 1175 | @defspec unwind-protect body-form cleanup-forms@dots{} |
| 1173 | @cindex cleanup forms | 1176 | @cindex cleanup forms |