[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: So, what the heck is a continuation anyway?




  >   >
  >   >     {
  >   >        int i = 0;
  >   >        make_continuation();
  >   >        print i;
  >   >        i = 3;
  >   >     }

Here is a translation of your example: 

  Welcome to MzScheme version 103, Copyright (c) 1995-2000 PLT (Matthew Flatt)
  > (define KK #f)
  > (let ([i 0])
      (call/cc (lambda (k) (set! KK k))) ;; make_continuation_and_store_in_KK
      (printf "~s~n" i)
      (set! i 3))
  0

Now invoke your continuation: 

  > (KK 'dummy)
  3
  > (KK 'dummy)
  3
  > 

-- Matthias