scsh-0.6/scsh/continuation.scm

22 lines
555 B
Scheme

;;; Move this to somewhere else as soon as Marc has published his SRFI
(define (continuation-capture receiver)
((call-with-current-continuation
(lambda (cont)
(lambda () (receiver cont))))))
(define (continuation-graft cont thunk)
(cont thunk))
(define (continuation-return cont . returned-values)
(continuation-graft
cont
(lambda () (apply values returned-values))))
;;; Call THUNK, then die.
(define (call-terminally thunk)
(with-continuation null-continuation thunk))
;; from shift-reset.scm:
(define null-continuation #f)