Next: SRFI-4, Previous: SRFI-1, Up: SRFI Support
The syntactic form and-let* combines the conditional evaluation
form and with the binding form let*. Each argument
expression will be evaluated sequentially, bound to a variable (if a
variable name is given), but only as long as no expression returns
the false value #f.
Evaluate form (use-modules (srfi srfi-2)), or alternatively
(use-modules (ice-9 and-let-star)), to access this syntax form.
A short example will demonstrate how it works. In the first expression,
x will get bound to 1, but the next expression (#f) is
false, so evaluation of the form is stopped, and #f is returned.
In the next expression, x is bound to 1, y is bound to
#t and since no expression in the binding section was false, the
body of the and-let* expression is evaluated, which in this case
returns the value of x.
(and-let* ((x 1) (y #f)) 42)
⇒ #f
(and-let* ((x 1) (y #t)) x)
⇒ 1