diff options
author | Alex AUVOLAT <alex.auvolat@ens.fr> | 2014-05-25 01:00:44 +0200 |
---|---|---|
committer | Alex AUVOLAT <alex.auvolat@ens.fr> | 2014-05-25 01:00:44 +0200 |
commit | 4a5ca97b0970e191332fb6fb4684a397b93390f5 (patch) | |
tree | b833cd9bf8f21514f5c0ae2ece473ac398aff251 /src/example.ml | |
parent | 6e750a757ef6fb1f41cf4c2fe39edba834b76858 (diff) | |
download | SystemeReseaux-Projet-4a5ca97b0970e191332fb6fb4684a397b93390f5.tar.gz SystemeReseaux-Projet-4a5ca97b0970e191332fb6fb4684a397b93390f5.zip |
./manager -pool-addr mypool -pool-count 16 -my-addr my_addr ./example.native
Diffstat (limited to 'src/example.ml')
-rw-r--r-- | src/example.ml | 12 |
1 files changed, 5 insertions, 7 deletions
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 |