[R6RS] summary of decisions regarding multiple values

dyb at cs.indiana.edu dyb at cs.indiana.edu
Sat Jun 24 09:13:07 EDT 2006

> Kent wrote:
> > > > Not exactly.  The traditional CPS form of (lambda () (f (g))) is
> > > > (lambda (k) (g (lambda (v) (f v k)))).
> > >
> > > The proper translation of that CPS-transform into
> > > Scheme is (lambda (k) (g (lambda v (apply f k v)))).
> >
> > Under your proposal, this won't toss the extra values returned by g, will
> > it?  Won't f complain about receiving the wrong number of arguments?
> Had you stated the traditional CPS transform correctly,
> the transformed version would have used the transformed
> f and g instead of the original.  (Notice, for example,
> that g takes zero arguments in the original but one in
> the transform.  That's because they're really two
> different functions.)  The transforms of f and g would
> include an analogue of your wrapper that discards extra
> arguments and uses #!unspecified if there are none.

If the transform of f and g were to discard extra arguments and use
#!unspecified if there are none, then they wouldn't signal an error when
given too many or two few arguments, which they are required to do
in your proposal.


More information about the R6RS mailing list