Node:Multiple values, Next:Special named constants, Previous:Syntax and conditional compilation, Up:Extensions
The multiple-value feature was added in R5RS.
values object ... | Function |
Delivers all of its arguments to its continuation. |
call-with-values thunk receiver | Function |
Call its thunk argument with a continuation that, when passed some values, calls the receiver procedure with those values as arguments. |
let-values ((formals expression) ...) body | Syntax |
Each formals should be a formal arguments list as for a lambda ,
cf section 4.1.4 of the R5RS.
The expressions are evaluated in the current environment, the variables of the formals are bound to fresh locations, the return values of the expressions are stored in the variables, the body is evaluated in the extended environment, and the values of the last expression of body are returned. The body is a "tail body", cf section 3.5 of the R5RS. The matching of each formals to values is as for the matching of
formals to arguments in a (let-values ((a b . c) (values 1 2 3 4))) (list a b c)) --> (1 2 (3 4)) (let ((a 'a) (b 'b) (x 'x) (y 'y)) (let-values (((a b) (values x y)) ((x y) (values a b))) (list a b x y))) --> (x y a b) |
let*-values ((formals expression) ...) body | Syntax |
Each formals should be a formal arguments list as for a
(let ((a 'a) (b 'b) (x 'x) (y 'y)) (let*-values (((a b) (values x y)) ((x y) (values a b))) (list a b x y))) --> (x y x y) |
receive formals expression body | Syntax |
The formals, expression, and body are as described in R5RS.
Specifically, formals can have any of three forms:
In any case, the expressions in body are evaluated sequentially in the extended environment. The results of the last expression in the body are the values of the receive-expression. |
values-append arg1 ... | Function |
The values resulting from evaluating each argument are appended together. |