Node:SRFI-2, Next:, Previous:SRFI-1, Up:SRFI Support

39.4 SRFI-2 - and-let*

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.

Use (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 (#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)
(and-let* ((x 1) (y #t)) x)