| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
srfi-11 - Let-values Defines two macros, let-values and let*-values.
They are convenient to use with multiple values ([SRFI-11]).
[SRFI-11]
vars are a list of variables. expr is evaluated, and
its first return value is bound to the first variable in vars,
its second return value to the second variable, and so on, then
body is evaluated.
The scope of exprs are the outside of 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.
[SRFI-11]
Same as 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)
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] |
This document was generated by Shiro Kawai on October, 7 2008 using texi2html 1.78.