Last active
August 2, 2018 03:07
-
-
Save JoshOrndorff/33d979f3b587854b466f8d93b67f4ee1 to your computer and use it in GitHub Desktop.
Run several rholang proceses sequentially
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
new seq in { | |
// Take a cons list of contracts, run them sequentially | |
contract seq(@[head, tail], @ack) = { | |
new return in { | |
@head!(*return) | |
| | |
for (_ <- return){ | |
seq!(tail, ack) | |
} | |
} | |
} | |
| | |
// Terminating case | |
contract seq(@[], ack) = { | |
ack!(0) | |
} | |
| | |
// Names for our three contracts and ack channel | |
new p1, p2, p3, localAck in { | |
contract p1(@return) = { | |
@"stdoutAck"!("p1", return) | |
} | |
| | |
contract p2(@return) = { | |
@"stdoutAck"!("p2", return) | |
} | |
| | |
contract p3(@return) = { | |
@"stdoutAck"!("p3", return) | |
} | |
| | |
// Let's actually call this thing | |
seq!([*p1, [*p2, [*p3, []]]], *localAck) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment