From 4a5ca97b0970e191332fb6fb4684a397b93390f5 Mon Sep 17 00:00:00 2001 From: Alex AUVOLAT Date: Sun, 25 May 2014 01:00:44 +0200 Subject: ./manager -pool-addr mypool -pool-count 16 -my-addr my_addr ./example.native --- src/example.ml | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'src/example.ml') diff --git a/src/example.ml b/src/example.ml index 43e5327..1b0f274 100644 --- a/src/example.ml +++ b/src/example.ml @@ -28,11 +28,10 @@ module Example (K : Kahn.S) = struct let output (qi : (int * int) K.in_port) : unit K.process = let rec loop () = - K.bind_io - (K.get qi) + (K.get qi) >>= (fun (v, s) -> if v <> -1 then - begin Format.eprintf "f(%d) = %d@." v s; loop () end + begin K.output @@ Format.sprintf "f(%d) = %d@." v s; loop () end else K.return ()) in loop () @@ -64,10 +63,9 @@ module Example (K : Kahn.S) = struct fib_rec (n-2) (r-1) q_out ; fib_rec (n-1) (r-1) q_out2 ; K.get q_in >>= (fun x -> - K.bind_io - (K.get q_in2) + (K.get q_in2) >>= (fun y -> - Format.eprintf "f(%d) = %d@." n (x+y); + K.output @@ Format.sprintf "f(%d) = %d@." n (x+y); K.put (x+y) qo)) ] ))) @@ -76,7 +74,7 @@ module Example (K : Kahn.S) = struct let main2 : int K.process = (delay K.new_channel()) >>= (fun (qi, qo) -> - (fib_rec 47 7 qo) >>= + (fib_rec 50 7 qo) >>= (fun () -> K.get qi)) end -- cgit v1.2.3