Here is a lightly tested source of one shot continuations named as in Chez-Scheme. It also enforces the heuristic that the procedure argument to call/cc should never return. I have not found a useful exception to this rule and its violation has caused me much debug time.
(define (call/1cc lam) (let ((x #t)) (call/cc (lambda (rc) (lam (lambda a (if x (begin (set! x #f) (apply rc a)) (begin (write "Die: reused") (newline) (exit))))) (begin (write "Die: lambda returned") (newline) (exit))))))A few simple tests:
(define c '()) (call/1cc (lambda (x) (set! c x) (x 14))) (c 3)which illustrates failure upon reuse, or
(define c '()) (call/1cc (lambda (x) (set! c x)))Which shows diagnoses of the return of the argument to call/1cc.