8.16.0.1
8 Let-Return
(require scramble/let-return) | package: scramble-lib |
Added in version 0.4 of package scramble-lib.
syntax
(let-return ([id rhs-expr] ...) body ...+)
Similar to (let ([id rhs-expr] ...) body ...+), but discards the result
of the body and returns (values id ...) instead.
Useful for combining the creation and initialization of mutable objects into a single expression.
Examples:
> (define the-table (let-return ([h (make-hash)]) (hash-set! h 'a 1) (hash-set! h 'b 2))) > the-table '#hash((a . 1) (b . 2))