Created
January 25, 2020 03:21
-
-
Save xguerin/158056a6fd3cd0a19c404b44eeb28355 to your computer and use it in GitHub Desktop.
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
let beacon = | |
new beacon ~zero:(fun() -> 0) ~next:(fun v -> v + 1) | |
let apply_fn (v0, v1) = | |
Logs_lwt.info (fun m -> m "(%d, %d)" v0 v1) | |
>>= fun () -> Lwt.return (v0, v1) | |
let () = | |
Logs.set_reporter (Logs.format_reporter ()); | |
Logs.set_level (Some Logs.Info); | |
(* Streams *) | |
[%fstream | |
(Vertex("B0", beacon) +> Vertex("B1", beacon)) | |
*> | |
Vertex("M0", new merge) | |
+> | |
Vertex("M0", ()) | |
*> | |
Vertex("A0", new apply ~fn:apply_fn) | |
+> | |
Vertex("A0", ()) | |
*> | |
Vertex("S0", new sink) | |
] | |
|> List.map(fun e -> e#process) | |
|> Lwt.join | |
|> Lwt_main.run |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment