Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

which library and how to do parallel run and wait with timeout and notify among functions in ocaml like this python script

33 views
Skip to first unread message

Ho Yeung Lee

unread,
Feb 23, 2016, 7:43:29 AM2/23/16
to
which library and how to do parallel run and wait with timeout and notify among functions in ocaml like this python script

https://groups.google.com/forum/#!topic/comp.lang.python/r7wfvtpY58E

Ho Yeung Lee

unread,
Feb 23, 2016, 8:44:39 AM2/23/16
to
Ho Yeung Lee於 2016年2月23日星期二 UTC+8下午8時43分29秒寫道:
> which library and how to do parallel run and wait with timeout and notify among functions in ocaml like this python script
>
> https://groups.google.com/forum/#!topic/comp.lang.python/r7wfvtpY58E

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;;
0 new messages