Continued on the diagram

I think I got what is a continuation (in general), but I can’t understand how it is used in the Scheme.

Consider this example (from wikipedia call / cc )

(define (f return)
  (return 2)
  3)
(display (call/cc f)) ;=> 2

I can not understand why:

  • continued implicitly? right?

  • How to continue in this case?

+3
source share
1 answer

The sequel is the "rest of the calculation" that has yet to be completed. In your specific example, you might think of it as (display [])where, where []is the hole that should be inserted with the value. That is, at the time of the call call/cc, what else needs to be done is the call to display.

call/cc , , . ( f). f return. , (return 2) 2 , .. (display 2).

, , , PLAI, (. VII). .

+12

All Articles