Skip to content

Instantly share code, notes, and snippets.

@JoshOrndorff
Last active August 2, 2018 03:07
Show Gist options
  • Save JoshOrndorff/33d979f3b587854b466f8d93b67f4ee1 to your computer and use it in GitHub Desktop.
Save JoshOrndorff/33d979f3b587854b466f8d93b67f4ee1 to your computer and use it in GitHub Desktop.
Run several rholang proceses sequentially
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