In the discussion about continuation passing style, I forgot to explain
the semantics of when and how Guile discards extra return values.  It's
very simple:

I wrote:
> Here's what (lambda () (list (f 1) (f 2) (f 3))) looks like in CPS,
> using the same evaluation order as I chose above:
>
>   (lambda (outer-k)
>     (f^ 2 (lambda (y)
>             (f^ 1 (lambda (x)
>                     (f^ 3 (lambda (z)
>                             (list^ x y z outer-k))))))))

In the CPS examples, I modelled these normal "unary" continuations as
unary procedures of the form:

  (lambda (x) ...)

In Guile, these "unary" continuations are not truly unary.  Instead,
they can be modeled roughly as procedures of this form:

  (lambda (x . _) ...)

Where '_' does not occur free in the body.  So, to model Guile's
behavior in CPS, the example above becomes:

   (lambda (outer-k)
     (f^ 2 (lambda (y . _)
             (f^ 1 (lambda (x . _)
                     (f^ 3 (lambda (z . _)
                             (list^ x y z outer-k))))))))

       Mark

Reply via email to