diff options
author | Alex AUVOLAT <alex.auvolat@ens.fr> | 2014-05-24 23:25:07 +0200 |
---|---|---|
committer | Alex AUVOLAT <alex.auvolat@ens.fr> | 2014-05-24 23:25:07 +0200 |
commit | 6e750a757ef6fb1f41cf4c2fe39edba834b76858 (patch) | |
tree | f339630beb8a9a1a6f3544b40547ce9c83f23a91 /src/example.ml | |
parent | c5e69a904e79e807c5b075c08ce82183133e7b4c (diff) | |
download | SystemeReseaux-Projet-6e750a757ef6fb1f41cf4c2fe39edba834b76858.tar.gz SystemeReseaux-Projet-6e750a757ef6fb1f41cf4c2fe39edba834b76858.zip |
./manager -local-proc 4 ./example.native does what expected.
Diffstat (limited to 'src/example.ml')
-rw-r--r-- | src/example.ml | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/src/example.ml b/src/example.ml index 4971448..43e5327 100644 --- a/src/example.ml +++ b/src/example.ml @@ -32,7 +32,7 @@ module Example (K : Kahn.S) = struct (K.get qi) (fun (v, s) -> if v <> -1 then - begin Format.printf "f(%d) = %d@." v s; loop () end + begin Format.eprintf "f(%d) = %d@." v s; loop () end else K.return ()) in loop () @@ -67,25 +67,22 @@ module Example (K : Kahn.S) = struct K.bind_io (K.get q_in2) (fun y -> - Format.printf "f(%d) = %d@." n (x+y); + Format.eprintf "f(%d) = %d@." n (x+y); K.put (x+y) qo)) ] ))) - let main2 : unit K.process = + let main2 : int K.process = (delay K.new_channel()) >>= (fun (qi, qo) -> - K.doco - [ - fib_rec 53 7 qo; - K.bind_io - (K.get qi) - (fun v -> Format.printf "Got it! Result is %d@." v; K.return ()) - ]) + (fib_rec 47 7 qo) >>= + (fun () -> K.get qi)) end -module E = Example(Kahn_seq.Seq) +module E = Example(Kahn_stdio.ProtoKahn) -let () = E.K.run E.main2 +let () = + let r = E.K.run E.main2 in + Format.eprintf "Final result: %d@." r |