open New_callcc;; eval (fun p -> let callcc x = callcc p x and throw x = throw p x in let fun_to_cc f = callcc (fun k -> let (a,c) = callcc (throw k) in throw c (f a)) in let cc_to_fun cc = fun a -> callcc (fun k -> (throw cc (a,k))) in let cc = fun_to_cc (fun x -> x*x) in let rr = cc_to_fun cc 5 in print_int rr; print_newline() );; let fun_to_cc p f = callcc p (fun k -> let (a,c) = callcc p (throw p k) in throw p c (f a));; let cc_to_fun p cc = fun a -> callcc p (fun k -> (throw p cc (a,k)));; eval (fun p -> let cc = fun_to_cc p (fun x -> x*x) in let rr = cc_to_fun p cc 5 in print_int rr; print_newline() );; let valcc = ref None;; eval (fun p -> let cc = fun_to_cc p (fun x -> x*x) in valcc := Some cc; ());; print_newline();; let valrr = ref None;; eval (fun p -> let Some cc = !valcc in let rr = cc_to_fun p cc 5 in valrr := Some rr; ());; !valrr;;