> (let ((x 0)) (list (call/cc (lambda (f) (set! x 1) (f 2))) x)) (2 0)
localhost:~/oort/examples% ../oort callcc2.nl 2 1
The Oort program:
typedef continuation_t = fn (p: int32) -> void; call_cc (fun: fn(k: continuation_t) -> void) -> int32 { retval: int32; fun (fn (v: int32) -> void { retval = v; goto current_continuation; }); // If fun returns without calling the continuation, // then just return 0 return 0; @current_continuation: return retval; } x: int32 = 0; print call_cc (fn (k: continuation_t) { x = 1; k (2); }); print x;
The Oort program: