QCaml/Parallel_serial/Farm.ml

14 lines
272 B
OCaml
Raw Normal View History

2019-01-15 15:17:34 +01:00
(* Single process function *)
let run_sequential f stream =
2019-09-10 18:39:14 +02:00
let next _ =
2019-01-15 15:17:34 +01:00
try
let task = Stream.next stream in
Some (f task)
with Stream.Failure -> None in
Stream.from next
2019-04-04 09:14:15 +02:00
let run ?(ordered=true) ?(comm) ~f stream =
2019-01-15 15:17:34 +01:00
run_sequential f stream