I've read a lot about call/cc, and each time wind up just moving on. So
this is an early New Year's resolution: getting a better understanding of
it.

According to Wikipedia's page on continuations, the continuation of the
statement:

((call/cc f) e2)

is:

(lambda (c) (c e2))

#lang racket
(define ret #f)
(define ret2 (lambda (c) (add1 c)))

(add1
 (call/cc
  (lambda (k)
    (set! ret k) ;; Now ret should be equivalent to ret2.
    2)))

(ret 9) ;; Why does this print twice?
(ret2 5) ;; This only prints once, like I would have expected.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CACgrOx%2BnXZpQv_MbDwdAZJSGpMiD%2BE1gB4YH8Rsb_y3%3D6RaAnQ%40mail.gmail.com.

Reply via email to