gscheme/examples/call-cc.scm

12 lines
225 B
Scheme

(define rec
(lambda (n stop)
(display n) (newline)
(if (= n 0) (stop 0)
(begin
(rec (- n 1) stop)
(display n) (newline)))))
(rec 6 (lambda (x) '()))
(call-with-current-continuation
(lambda (t) (rec 6 t)))