User loginNavigation |
"Prep" in programming languages"Prep" is a neglected topic in programming languages. Consider the following example of unbounded nondeterminism:
CreateUnbounded.[ ]:Integer ≡
Let aCounter ← SimpleCounter.[ ]。 // let aCounter be a new Counter
Prep □aCounter.go[ ]。 // send aCounter a go message and concurrently
□aCounter.stop[ ]▮ // return the result of sending aCounter a stop message
CreateUnbounded.[ ] is an unbounded integer. As a notational convenience, when an Actor receives message then it can send an arbitrary message to itself by prefixing it with “..” as in the following example:
Actor SimpleCounter[ ]
count ≔ 0, // the variable count is initially 0
continue ≔ True。
implements Counter using
stop[ ] →
count // return count
afterward continue ≔ False¶ // continue is updated to False for the next message received
go[ ] →
continue �
True ⦂ Prep count ≔ count+1⚫。 // increment count
hole ..go[ ] ⍌ // In a hole of the cheese, send go[ ] to this counter
False ⦂ Void▮ // if continue is False, return Void
Interface Counter with
stop[ ] ↦ Integer,
go[] ↦ Void▮
By Hewitt at 2015-07-22 00:35 | LtU Forum | previous forum topic | next forum topic | other blogs | 10141 reads
|
Browse archives
Active forum topics |
Recent comments
4 days 13 hours ago
4 days 13 hours ago
4 days 13 hours ago
3 weeks 5 days ago
4 weeks 3 days ago
4 weeks 3 days ago
4 weeks 5 days ago
4 weeks 5 days ago
4 weeks 5 days ago
5 weeks 22 hours ago