[plt-scheme] Why multiple values?

From: Greg Woodhouse (gregory.woodhouse at sbcglobal.net)
Date: Sun Dec 24 13:47:40 EST 2006

This is undoubtedly a basic question, but I don't think I quite grasp the concept behind (values ...). I know I can write, say

(define-values (x y z) (values 1 2 3))

but I don't understand why this construct is needed. Couldn't I just as easily write

(define x 1)
(define y 2)
(define z 3) ?

I kind of suspect values is there because it supports some programming idiom, or because it is needed in conjunction with some other language feature, but I'm not sure what.
 
===
Gregory Woodhouse 
 
"Mathematics is the science of patterns."
--Lynn Arthur Steen, 1988


Posted on the users mailing list.