@c -*-texinfo-*-
@c This is part of the GNU Emacs Lisp Reference Manual.
-@c Copyright (C) 1990-1995, 1998-1999, 2001-2014 Free Software
+@c Copyright (C) 1990-1995, 1998-1999, 2001-2015 Free Software
@c Foundation, Inc.
@c See the file elisp.texi for copying conditions.
@node Control Structures
@node Sequencing
@section Sequencing
+@cindex sequencing
+@cindex sequential execution
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
@example
(defun evaluate (exp env)
(pcase exp
- (`(add ,x ,y) (+ (evaluate x env) (evaluate y env)))
- (`(call ,fun ,arg) (funcall (evaluate fun env) (evaluate arg env)))
- (`(fn ,arg ,body) (lambda (val)
- (evaluate body (cons (cons arg val) env))))
- ((pred numberp) exp)
- ((pred symbolp) (cdr (assq exp env)))
- (_ (error "Unknown expression %S" exp))))
+ (`(add ,x ,y) (+ (evaluate x env) (evaluate y env)))
+ (`(call ,fun ,arg) (funcall (evaluate fun env) (evaluate arg env)))
+ (`(fn ,arg ,body) (lambda (val)
+ (evaluate body (cons (cons arg val) env))))
+ ((pred numberp) exp)
+ ((pred symbolp) (cdr (assq exp env)))
+ (_ (error "Unknown expression %S" exp))))
@end example
Where @code{`(add ,x ,y)} is a pattern that checks that @code{exp} is a three
More specifically, a Q-pattern can take the following forms:
@table @code
@item (@var{qpattern1} . @var{qpattern2})
-This pattern matches any cons cell whose @code{car} matches @var{QPATTERN1} and
-whose @code{cdr} matches @var{PATTERN2}.
-@item [@var{qpattern1 qpattern2..qpatternm}]
-This pattern matches a vector of length @code{M} whose 0..(M-1)th
-elements match @var{QPATTERN1}, @var{QPATTERN2}..@var{QPATTERNm},
+This pattern matches any cons cell whose @code{car} matches @var{qpattern1} and
+whose @code{cdr} matches @var{pattern2}.
+@item [@var{qpattern1} @var{qpattern2} @dots{} @var{qpatternm}]
+This pattern matches a vector of length @var{M} whose 0..(@var{M}-1)th
+elements match @var{qpattern1}, @var{qpattern2} @dots{} @var{qpatternm},
respectively.
@item @var{atom}
This pattern matches any atom @code{equal} to @var{atom}.
@node Combining Conditions
@section Constructs for Combining Conditions
+@cindex combining conditions
This section describes three constructs that are often used together
with @code{if} and @code{cond} to express complicated conditions. The
@node Processing of Errors
@subsubsection How Emacs Processes Errors
+@cindex processing of errors
When an error is signaled, @code{signal} searches for an active
@dfn{handler} for the error. A handler is a sequence of Lisp
@node Cleanups
@subsection Cleaning Up from Nonlocal Exits
+@cindex nonlocal exits, cleaning up
The @code{unwind-protect} construct is essential whenever you
temporarily put a data structure in an inconsistent state; it permits