Ho Yeung Lee於 2016年2月23日星期二 UTC+8下午8時43分29秒寫道:
there is an syntax error when i run below script
final goal is to do parallel run and wait with timeout and notify among functions in ocaml like this python script
ocamlc -o mam
mam.ml
let f000 () =
try_with (fun () -> maybe_raise ())
>>| function
| Ok () -> print_endline "000"
| Error _ -> print_endline "exception 000"
let f001 () =
try_with (fun () -> maybe_raise ())
>>| function
| Ok () -> print_endline "001"
| Error _ -> print_endline "exception 001"
let f002 () =
try_with (fun () -> maybe_raise ())
>>| function
| Ok () -> print_endline "002"
| Error _ -> print_endline "exception 002"
let f003 () =
try_with (fun () -> maybe_raise ())
>>| function
| Ok () -> print_endline "003"
| Error _ -> print_endline "exception 003"
let f004 () =
try_with (fun () -> maybe_raise ())
>>| function
| Ok () -> print_endline "004"
| Error _ -> print_endline "exception 004"
let mappedfunc = Hashtbl.create 100000;
Hashtbl.add mappedfunc "000" f000;
Hashtbl.find mappedfunc "000";
let runallevents =
for k v in Hashtbl mappedfunc do
Deferred.all_unit (Hashtbl.find mappedfunc k)
done;;