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

will the real current continuation please stand up



I think they're equipotent, if you allow a little bit of kludgery.

I take it you would define
    (current-continuation)
to mean the same as
    (call-with-current-continuation (lambda (c) c))  ?

Then e.g.
    (let ((c (current-continuation)))
      (cond ((eq? c 'a) 'b)
	    (else (c 'a))))
would evaluate to b.

Then I think you could just do this:

(define (call-with-current-continuation p)
  (let ((c (current-continuation)))
    (cond ((pair? c)
	   (car c))
	  (else
	   (p (lambda (val) (c (cons val nil))))))))

I think it's somewhat more natural to take
call-with-current-continuation as primitive.