[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
multiple values proposal
From: Pavel Curtis <Pavel@parc.xerox.com>
Sender: Pavel Curtis <pavel@parc.xerox.com>
Fake-Sender: pavel@parc.xerox.com
References: <9303181630.AA04252@Sunburn.Stanford.EDU>
<9303181753.AA29539@quilty.Stanford.EDU>
Date: Thu, 18 Mar 1993 10:21:10 PST
> Date: Thu, 18 Mar 1993 09:53:55 -0800
> From: Morry Katz <katz@quilty.stanford.edu>
>
> I hate to throw a monkey wrench into the whole process, but the above
> does not match my recollection of what was approved at the R5RS
> meeting. In the expression
> (call-with-values
> (call-with-current-continuation
> (lambda (k)
> (k (values 1 2 3))))
> (lambda (a b c)
> . . .))
>
> k better be a continuation that accepts 3 values or things are going
> to be very broken.
There are two bugs in this code. The first is that the first argument to
CALL-WITH-VALUES is supposed to yield a thunk.
Sorry about the typo folks. Somehow I deleted a line when reformating.
The second is that the call to
VALUES is in argument position and so certainly returns the wrong number of
values for its continuation.
I really am not sure what the syntax is supposed to be when passing
multiple values to a continuation, but I agree that Pavel's syntax is
preferable to mine.
Here is what I suspect Morry meant to write:
(call-with-values (lambda ()
(call-with-current-continuation
(lambda (k)
(k 1 2 3))))
(lambda (a b c)
. . .))
And now, this looks to me like code that's entirely legal under the description
that was posted.
I have to disagree. I do not see how this is legal under the
description posted. According to the description: "Except for
continuations created by the call-with-values procedure, all
continuations take exactly one value." Since k is not a continuation
created by the call-with-values procedure, it must accept exactly one
value, making (k 1 2 3) an illegal expression. Could someone please
clarify?
--------------------
Morry Katz
katz@cs.stanford.edu
--------------------