Node:SRFI-2, Next:SRFI-4, Previous:SRFI-1, Up:SRFI Support
The syntactic form
and-let* combines the conditional evaluation
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
(use-modules (srfi srfi-2) 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 (
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