[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Revised multiple values and call/cc.



Let me revise the proposal by substituting

  Within procedure 'generator', the initial escape procedure returned 
  by call-with-current-continuation is like 'receiver' except that 
  this escape procedure's continuation is the one that was in effect 
  when the evaluation of the with-values expression began (see
  call-with-current-continuation).

for

  Within procedure 'generator', the initial escape procedure returned
  by call-with-current-continuation is 'receiver'.

--------------------------------

(values obj ...)                                        essential procedure

Applies the current continuation to 0 or more values.  It is used to
return multiple values (see with-values).  Values could be defined as:
	
	(define (values . args)
	  (call-with-current-continuation
	    (lambda (cont) (apply cont args))))

(with-values generator receiver)      			essential procedure

Returns the result of applying the procedure 'receiver' to the values
produced by calling procedure 'generator' with no arguments.  It is an
error if 'receiver' cannot be applied to the number of values returned
by 'generator' or if 'generator' cannot be called with zero arguments.
Within procedure 'generator', the initial escape procedure returned by
call-with-current-continuation is like 'receiver' except that this
escape procedure's continuation is the one that was in effect when
the evaluation of the with-values expression began (see
call-with-current-continuation).

        (with-values 
          (lambda ()
            (values 1 2))
	  cons)   	      =>              (1 . 2)

        (with-values 
          (lambda ()
	    (call-with-current-continuation
	      (lambda (k) 
		(k 1 2))))
	  cons)   	      =>              (1 . 2)

-------------------------------

Notice that the discussion of the arity of ordinary continuations must
be moved to the section describing call-with-current-continuation.  I
have yet to draft any text, but I have not forgotten the problem.

John