libretto.examples
Type members
Classlikes
Reads lines from standard input and prints them to standard output.
Reads lines from standard input and prints them to standard output.
This example implements interaction between two parties, Alice and Bob, in which
This example implements interaction between two parties, Alice and Bob, in which
- Alice sends "ping" to Bob,
- Bob sends "pong" back to Alice,
- Alice sends Done to Bob,
in this order, after which no more interaction between the two takes place.
This example demonstrates:
- A simple protocol between two parties.
- Linearity: obligation to consume every input exactly once and fulfill every demand exactly once. Linearity is key to ensuring adherence to a protocol.
- Inverting the flow of values from left-to-right to right-to-left and vice versa.
This example implements interaction between two parties, Alice and Bob, in which
This example implements interaction between two parties, Alice and Bob, in which
- when it's Alice's turn, she can choose to send "ping" to Bob or to quit;
- when it's Bob's turn, he can choose to send "pong" back to Alice, or to quit;
- interaction continues until one of the parties quits.
This is an extension of the PingPong example to multiple rounds of ping-pong. It further demonstrates:
N scientists sharing M microscopes (N > M).
N scientists sharing M microscopes (N > M).
This examples demonstrates:
- concurrency (scientists operate concurrently)
- sequencing (each scientist performs experiments sequentially, at most one at a time)
- resource sharing via pooling (the limited number of microscopes is made available throught a pool)