From 0e4a335edc7d4e584924fd6b298156e45d2626c8 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Sun, 6 Sep 2015 16:35:46 -0700 Subject: 2175 --- html/channel.mu.html | 62 +++++++++++++++++++++++++--------------------------- 1 file changed, 30 insertions(+), 32 deletions(-) (limited to 'html/channel.mu.html') diff --git a/html/channel.mu.html b/html/channel.mu.html index 420eed5e..ce564ded 100644 --- a/html/channel.mu.html +++ b/html/channel.mu.html @@ -13,12 +13,10 @@ pre { white-space: pre-wrap; font-family: monospace; color: #eeeeee; background-color: #080808; } body { font-family: monospace; color: #eeeeee; background-color: #080808; } * { font-size: 1.05em; } -.muRecipe { color: #ff8700; } -.Comment { color: #9090ff; } -.Constant { color: #00a0a0; } .Special { color: #ff6060; } -.Delimiter { color: #a04060; } -.muControl { color: #c0a020; } +.Comment { color: #9090ff; } +.Underlined { color: #c000c0; text-decoration: underline; } +.Identifier { color: #804000; } --> @@ -32,44 +30,44 @@ body { font-family: monospace; color: #eeeeee; background-color: #080808; }
 # example program: communicating between routines using channels
 
-recipe producer [
+recipe producer [
   # produce numbers 1 to 5 on a channel
-  local-scope
-  chan:address:channel <- next-ingredient
+  local-scope
+  chan:address:channel <- next-ingredient
   # n = 0
-  n:number <- copy 0
-  {
-    done?:boolean <- lesser-than n, 5
-    break-unless done?
+  n:number <- copy 0
+  {
+    done?:boolean <- lesser-than n, 5
+    break-unless done?
     # other threads might get between these prints
-    $print [produce: ], n, [ 
-]
-    chan:address:channel <- write chan, n
-    n <- add n, 1
-    loop
-  }
+    $print [produce: ], n, [
+]
+    chan:address:channel <- write chan, n
+    n <- add n, 1
+    loop
+  }
 ]
 
-recipe consumer [
+recipe consumer [
   # consume and print integers from a channel
-  local-scope
-  chan:address:channel <- next-ingredient
-  {
+  local-scope
+  chan:address:channel <- next-ingredient
+  {
     # read an integer from the channel
-    n:number, chan:address:channel <- read chan
+    n:number, chan:address:channel <- read chan
     # other threads might get between these prints
-    $print [consume: ], n:number, [ 
-]
-    loop
-  }
+    $print [consume: ], n:number, [
+]
+    loop
+  }
 ]
 
-recipe main [
-  local-scope
-  chan:address:channel <- new-channel 3
+recipe main [
+  local-scope
+  chan:address:channel <- new-channel 3
   # create two background 'routines' that communicate by a channel
-  routine1:number <- start-running producer:recipe, chan
-  routine2:number <- start-running consumer:recipe, chan
+  routine1:number <- start-running producer:recipe, chan
+  routine2:number <- start-running consumer:recipe, chan
   wait-for-routine routine1
   wait-for-routine routine2
 ]
-- 
cgit 1.4.1-2-gfad0