, F #, MailboxProcessor CCR, , , , , , F #, . CCR, , , COmega ( MSR).
, COmega F #:
public class OnePlaceBuffer {
private async empty();
private async contains(string s);
public OnePlaceBuffer() { empty(); }
public void Put(string s) & empty() {
contains(s);
}
public string Get() & contains(string s) {
empty();
return s;
}
}
async ( : empty, contains, Put Get), , , (.. ). F # MailboxProcessor :
type Message<'T> =
| Put of 'T * AsyncReplyChannel<unit>
| Get of AsyncReplyChannel<'T>
MailboxProcessor.Start(fun agent ->
let rec empty = agent.Scan(function
| Put(v, repl) -> repl.Reply(); Some(full(v))
| _ -> None)
and full v = agent.Scan(function
| Get repl -> repl.Reply(v); Some(empty)
| _ -> None)
empty )
, . F #, empty full - , , , , ( ). COmega .
, , , F # MailboxProcessor, ...
, , MailboxProcessor F #, , , , - . , , MailboxProcessor (, , , ). . .