diff options
Diffstat (limited to 'Semestr 3/pf/lista3/procc.ml')
-rw-r--r-- | Semestr 3/pf/lista3/procc.ml | 30 |
1 files changed, 0 insertions, 30 deletions
diff --git a/Semestr 3/pf/lista3/procc.ml b/Semestr 3/pf/lista3/procc.ml deleted file mode 100644 index 07f4404..0000000 --- a/Semestr 3/pf/lista3/procc.ml +++ /dev/null @@ -1,30 +0,0 @@ -type ('z,'i) in_channel = - | In of (('z,'i) out_channel -> 'z) - -and ('z,'o) out_channel = - | Out of ('o -> ('z,'o) in_channel -> 'z) - -type ('z,'i,'o) ans = ('z,'i) in_channel -> ('z,'o) out_channel -> 'z - -type ('a,'z,'i,'o) proc = ('a -> ('z,'i,'o) ans) -> ('z,'i,'o) ans - -let send o k in_ch (Out sendd) = - sendd o (In(fun out_ch -> k () in_ch out_ch)) - -let recv k (In recv) out_ch = - recv (Out(fun v in_ch -> k v in_ch out_ch)) - -let exit_k x _ _ = x - -let (<|>>) p1 p2 _ in_ch out_ch = - p2 exit_k - (In(fun m_ch -> p1 exit_k in_ch m_ch)) - out_ch - -let rec stdin_ch = - In (fun (Out send) -> send (read_line ()) stdin_ch) - -let rec stdout_ch = - Out (fun str (In recv) -> print_endline str; recv stdout_ch) - -let run p = p exit_k stdin_ch stdout_ch |