| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
srfi-11 - Let-values let-values and let*-values.
They are convenient to use with multiple values ([SRFI-11]).
let-values form,
like let.
(let-values (((a b) (values 1 2))
((c d) (values 3 4)))
(list a b c d)) => (1 2 3 4)
(let ((a 1) (b 2) (c 3) (d 4))
(let-values (((a b) (values c d))
((c d) (values a b)))
(list a b c d))) => (3 4 1 2)
|
vars can be a dotted list or a single symbol, like the lambda parameters.
(let-values (((x . y) (values 1 2 3 4))) y) => (2 3 4) (let-values ((x (values 1 2 3 4))) x) => (1 2 3 4) |
If the number of values returned by expr doesn't match what vars expects, an error is signalled.
let-values, but each expr's scope includes
the preceding vars.
(let ((a 1) (b 2) (c 3) (d 4))
(let*-values (((a b) (values c d))
((c d) (values a b)))
(list a b c d))) => (3 4 3 4)
|