Previous: Iteration Macros, Up: Iteration Forms [Contents][Index]
Special-clause operators are auxiliary operators in the sense that
they are heads of auxiliary forms that are only syntactically valid in
certain forms. In the case of special-clause operators, the auxiliary
forms they head are valid in the for-clause and body
positions of the iteration forms. Beside special-clause operators,
:do-in
is an auxiliary operator heading a sequence form, whose
specification can be found in later chapters.
Below, “the iteration” can be an empty iteration when no iteration clause follows the special clauses, whose body expanded so far are bodys. Moreover, the inner iteration does not affect the outer iteration when nesting occurs, unless the wording “the whole iteration” is used.
Special clauses are sequentially processed, such that the body produced
by the expander of a special clause is fed into the expander of another
special clause to its left. Nonetheless, :break
and
:final
clauses are specially expanded since they involve
non-local transformation in order to terminate the whole iteration. As
a result, they cannot be implemented by
define-for-special-clause
.
This special-clause operator immediately terminates the whole iteration
when (and [guard…])
is true before the
iteration.
This special-clause operator terminates the whole iteration after one
more iteration when (and [guard…])
is
true before the iteration.
This special-clause operator produces the following body:
(when (and [guard…]) [body…])
This special-clause operator produces the following body:
(unless (and [guard…]) [body…])
This special-clause operator produces the following body:
(pcase-let ([binding…]) [body…])
This special-clause operator produces the following body:
(pcase-let* ([binding…]) [body…])
This special-clause operator produces the following body:
(when-let ([binding…]) [body…])
This special-clause operator produces the following body:
(when-let* ([binding…]) [body…])
:exhaustive
] [pattern…] ¶This special-clause operator produces the following body where
pcase is pcase
(see (elisp)Pattern-Matching
Conditional) when :exhaustive
is omitted, otherwise it
is pcase-exhaustive
:
(pcase expression ((and [pattern…]) [body…]))
:as
as] [pattern…] ¶This special-clause operator produces the following body where as
is an identifier that defaults to _
when omitted:
(pcase expression ((and [pattern…]) nil) (as [body…]))
This special-clause operator prepends expressions to the body.
Previous: Iteration Macros, Up: Iteration Forms [Contents][Index]