Skip to content

Instantly share code, notes, and snippets.

Created August 18, 2016 11:12
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save anonymous/04d86b1f9897a981fe666fe45afc5b61 to your computer and use it in GitHub Desktop.
Save anonymous/04d86b1f9897a981fe666fe45afc5b61 to your computer and use it in GitHub Desktop.
nested continuations are tricky (see Alan Bawden)
(define (cc k) (call-with-current-continuation k))
(display (format ">>> ~s\n" (- 10 (cc (lambda (k) (+ 1 (+ 2 (k 10))))))))
(let ((k (cc (lambda (bind) (lambda (x) (+ 1 (cc (lambda (k) (bind k))))))))) (k 10))
(let ((k (cc (lambda (bind)
(lambda (x)
(+ 1 (cc (lambda (k)
(bind k)))))))))
(k 10))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment