mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-19 05:39:17 +02:00
1.2 KiB
1.2 KiB
SRFI 2 - and-let*
The (srfi 2)
library provides the and-let*
macro, an and
with local bindings.
Like an ordinary and
, an and-let*
special form evaluates its arguments -- expressions -- one after another in order, till the first one that yields #f
. Unlike and
, however, a non-#f result of one expression can be bound to a fresh variable and used in the subsequent expressions. and-let*
is a cross-breed between let*
and and
.
See the SRFI document for more information.
#and-let* (and-let* (claws) body
claws ::= '() | (cons claw claws)
claw ::= (variable expression) | (expression) |
bound-variable
- The
claws
are evaluated in the strict left-to-right order - For each
claw
, theexpression
part is evaluated first (orbound-variable
is looked up) - If the result is #f,
and-let*
immediately returns #f - Otherwise, if the
claw
is of the form(variable expression)
theexpression
's value is bound to a freshly madevariable
- The
variable
is available for the rest of theclaws
, and thebody
- As usual, all
variable
s must be unique (like inlet*
)