SHOW:
|
|
- or go back to the newest paste.
1 | val threshold: Int = 10 | |
2 | ||
3 | def main(args: Array[String]) { | |
4 | _execute(_main()) | |
5 | } | |
6 | ||
7 | def script.. | |
8 | ||
9 | demultiplex = | |
10 | var window: Int = 0 | |
11 | var counter: Int = 0 | |
12 | ( | |
13 | while (counter < 3) { | |
14 | =><1>s1: Int | |
15 | {window += s1; counter++} | |
16 | - | if (window > threshold) { |
16 | + | |
17 | - | =><2>s2: Int |
17 | + | if (window > threshold) { |
18 | - | {window -= s2} |
18 | + | =><2>s2: Int |
19 | - | } |
19 | + | {window -= s2} |
20 | } | |
21 | <=window | |
22 | window = 0 | |
23 | counter = 0 | |
24 | ... | |
25 | ) | |
26 | ||
27 | stream1 = <=20 ... | |
28 | stream2 = <=30 ... | |
29 | ||
30 | - | result = dataflowCommunicationScope { |
30 | + | result = |
31 | stream1 =<1>=> demultiplex | |
32 | stream2 =<2>=> demultiplex | |
33 | - | } |
33 | + | |
34 | main = result ==> (=>x: Int; {println(x)}) |