define-values -- r7rs Definition syntax;
define-values (from vonuvoli);Syntax keywords:
variable: identifier;expression: expression;Syntax variants:
(_ (variable |...|) expression)scheme:base -- (scheme base);scheme -- (scheme);(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 whereverdefineis 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 alambdaexpression 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.