[plt-scheme] multiple values question

From: Hugh Myers (hsmyers at gmail.com)
Date: Wed Jun 17 22:39:05 EDT 2009

Hi all,

Given a function that returns a list:

(define (f) (list 1 2 3))

How do I marry it up to (define!-values (a b c) ?

If I do the obvious:

> (define-values (a b c) (f))

I get:

define-values: context (defining "a", ...) expected 3 values, received
1 value: (1 2 3)

If I do something moderately bizarre like:

(define-values (a b c) (eval (flatten (list 'values (f)))))

it works in the REPL, but not as part of a function in the editor.

p.s. CL has a 'Multiple-value-setq which provides pretty much what I
need, but that is CL, not scheme...

Posted on the users mailing list.