The provided forms allow one to combine the basic Racket and logic with let.
(andlet ([id val-expr #:test maybe-proc] ...) expr ...)
Like Racket’s let
except the result of each expression val-exp
in the (id val-exp)
pairs is checked to be not #f
. Any time a val-expr
evaluates to #f
, the entire andlet
expression is #f
and subsequent bindings are not evaluated.
If a different condition than merely checking for falisty is required,
use the optional argument #:test to give a procedure to use for generating the #t or #f value. Like Racket, anything which isn’t
#f is considered #t.
Unlike Racket’s let, andlet is not capable of the named-let pattern of creating a procedure.
(andlet* ([id val-exp #:test maybe-proc] ...) expr ...)
, except as with Racket’s let*
, bindings are sequentially
introduced so subsequent val-exp
s may refer to the bound id
previous name/value pairs.
|> (andlet* ((a 10)|
| (b (+ a 10))|
| (a 20))|
| (+ a b))|