Binding Multiple Values (Guile Reference Manual)

Previous: , Up: Definitions and Variable Bindings [Contents][Index]


6.10.5 Binding multiple return values

Syntax: define-values formals expression

The 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 (q r) (floor/ 10 3))
(list q r) ⇒ (3 1)
(define-values (x . y) (values 1 2 3))
x ⇒ 1
y ⇒ (2 3)
(define-values x (values 1 2 3))
x ⇒ (1 2 3)

AltStyle によって変換されたページ (->オリジナル) /