The multiple-value feature was added in R5RS.

Delivers all of its arguments to its continuation.

Procedure: `call-with-values`

`producer`

`consumer`

Calls its

argument with no arguments and a continuation that, when passed some values, calls the`producer`

procedure with those values as arguments.`consumer`

(call-with-values (lambda () (values 4 5)) (lambda (a b) b)) ⇒ 5 (call-with-values * -) ⇒ -1

Performance note:If either theor`producer`

is a fixed-arity lambda expression it is inlined.`consumer`

Syntax: `define-values`

`formals`

`expression`

It is an error if a variable appears more than once in the set of

.`formals`

The

is evaluated, and the`expression`

are bound to the return values in the same way that the`formals`

in a`formals`

`lambda`

expression are matched to the arguments in a procedure call.(define-values (x y) (integer-sqrt 17)) (list x y) ⇒ (4 1) (let () (define-values (x y) (values 1 2)) (+ x y)) ⇒ 3

Syntax: `let-values`

**((**`formals`

`expression`

**)**`...`

**)**`body`

Each

should be a formal arguments list as for a`formals`

`lambda`

.The

s are evaluated in the current environment, the variables of the`expression`

are bound to fresh locations, the return values of the`formals`

s are stored in the variables, the`expression`

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.`body`

The matching of each

to values is as for the matching of`formals`

to arguments in a`formals`

`lambda`

expression, and it is an error for anto return a number of values that does not match its corresponding`expression`

.`formals`

(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)

Syntax: `let*-values`

**((**`formals`

`expression`

**)**`...`

**)**`body`

Each

should be a formal arguments list as for a`formals`

`lambda`

expression.

`let*-values`

is similar to`let-values`

, but the bindings are performed sequentially from left to right, and the region of a binding indicated by (`formals`

) is that part of the`expression`

`let*-values`

expression to the right of the binding. Thus the second binding is done in an environment in which the first binding is visible, and so on.(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)

Syntax: `receive`

`formals`

`expression`

`body`

This convenience form (from SRFI-8) is equivalent to:

(let-values ((`formals`

))`expression`

)`body`

For example:

(receive a (values 1 2 3 4) (reverse a)) ⇒ (4 3 2 1) (receive (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)) (receive (a b) (values x y) (receive (x y) (values a b) (list a b x y)))) ⇒ (x y x y)

Procedure: `values-append`

`arg1`

`...`

The values resulting from evaluating each argument are appended together.