define-values -- r7rs Definition
§

Kind
§

syntax;

Implemented by
§

Syntax signature
§

Syntax keywords:

Syntax variants:

Exports
§

Exports recursive
§

Description
§

(define-values <formals> <expression>)

Another kind of definition is provided by define-values, which creates multiple definitions from a single expression returning multiple values. It is allowed wherever define is allowed.

It is an error if a variable appears more than once in the set of <formals>.

Semantics: <Expression> is evaluated, and the <formals> are bound to the return values in the same way that the <formals> in a 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

The text herein was sourced and adapted as described in the "R7RS attribution of various text snippets" appendix.