Created
May 21, 2011 01:29
-
-
Save avsm/984125 to your computer and use it in GitHub Desktop.
delimcc fragment that seems to fail on ocamlopt but work in ocamlc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open Printf | |
open Delimcc | |
let p = new_prompt () | |
let main () = | |
let kr = ref (fun _ -> ()) in | |
push_prompt p (fun () -> | |
let foo = 15 in | |
let bar = foo + | |
shift0 p (fun k -> | |
kr := k; | |
) in | |
printf "res %d\n%!" bar; | |
); | |
!kr | |
let _ = | |
let k = main () in | |
k 10; | |
k 15; | |
let oc = open_out "foo" in | |
output_delim_value oc k; | |
close_out oc | |
let _ = | |
let ic = open_in "foo" in | |
let (k : int -> unit) = Marshal.from_channel ic in | |
k 20; | |
k 30 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment