Advertisement
Guest User

Untitled

a guest
Mar 19th, 2014
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scala 0.63 KB | None | 0 0
  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) {
  17.           =><2>s2: Int
  18.           {window -= s2}
  19.         }
  20.       }
  21.       <=window
  22.       window  = 0
  23.       counter = 0
  24.       ...
  25.     )
  26.  
  27.   stream1 = <=20 ...
  28.   stream2 = <=30 ...
  29.  
  30.   result = dataflowCommunicationScope {
  31.     stream1 =<1>=> demultiplex
  32.     stream2 =<2>=> demultiplex
  33.   }
  34.  
  35.   main = result ==> (=>x: Int; {println(x)})
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement