- (guard (<variable> <cond clause[1]> <cond clause[2]> ...) <body>)syntax
Syntax: Each <cond clause> is as in the specification of cond.
Semantics: The <body> is evaluated with an exception handler that binds the raised object (see raise) to <variable> and, within the scope of that binding, evaluates the clauses as if they were the clauses of a cond expression. That implicit cond expression is evaluated with the continuation and dynamic environment of the guard expression. If every <cond clause>'s <test> evaluates to #f and there is no else clause, then raise-continuable is invoked on the raised object within the dynamic environment of the original call to raise or raise-continuable, except that the current exception handler is that of the guard expression.
{{ (guard (condition
((assq 'a condition) => cdr) ((assq 'b condition))) (raise (list (cons 'a 42))))==> 42
(guard (condition
((assq 'a condition) => cdr) ((assq 'b condition))) (raise (list (cons 'b 23))))==> (b . 23) }}