From 805d58c6aeeeba3e4989c0eed6781b3861e8fae0 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Thu, 25 Jan 2018 22:39:31 -0800 Subject: 4199 --- html/channel.mu.html | 49 ++++++++++++++++++++++++------------------------- 1 file changed, 24 insertions(+), 25 deletions(-) (limited to 'html/channel.mu.html') diff --git a/html/channel.mu.html b/html/channel.mu.html index 4aad1713..62becf72 100644 --- a/html/channel.mu.html +++ b/html/channel.mu.html @@ -15,15 +15,14 @@ body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color a { color:#eeeeee; text-decoration: none; } a:hover { text-decoration: underline; } * { font-size: 12pt; font-size: 1em; } -.Conceal { color: #4e4e4e; } +.muControl { color: #c0a020; } +.muRecipe { color: #ff8700; } .LineNr { color: #444444; } .Delimiter { color: #800080; } -.Comment { color: #9090ff; } -.Comment a { color:#0000ee; text-decoration:underline; } .Constant { color: #00a0a0; } .Special { color: #c00000; } -.muControl { color: #c0a020; } -.muRecipe { color: #ff8700; } +.Comment { color: #9090ff; } +.Comment a { color:#0000ee; text-decoration:underline; } --> @@ -60,46 +59,46 @@ if ('onhashchange' in window) {
  1 # example program: communicating between routines using channels
  2 
- 3 def producer sink:&:sink:char -> sink:&:sink:char [
+ 3 def producer sink:&:sink:char -> sink:&:sink:char [
  4   # produce characters 1 to 5 on a channel
  5   local-scope
  6   load-inputs
  7   # n = 0
  8   n:char <- copy 0
  9   {
-10   ¦ done?:bool <- lesser-than n, 5
-11   ¦ break-unless done?
-12   ¦ # other threads might get between these prints
-13   ¦ $print [produce: ], n, [ 
+10     done?:bool <- lesser-than n, 5
+11     break-unless done?
+12     # other threads might get between these prints
+13     $print [produce: ], n, [ 
 14 ]
-15   ¦ sink <- write sink, n
-16   ¦ n <- add n, 1
-17   ¦ loop
+15     sink <- write sink, n
+16     n <- add n, 1
+17     loop
 18   }
-19   close sink
+19   close sink
 20 ]
 21 
-22 def consumer source:&:source:char -> source:&:source:char [
+22 def consumer source:&:source:char -> source:&:source:char [
 23   # consume and print integers from a channel
 24   local-scope
 25   load-inputs
 26   {
-27   ¦ # read an integer from the channel
-28   ¦ n:char, eof?:bool, source <- read source
-29   ¦ break-if eof?
-30   ¦ # other threads might get between these prints
-31   ¦ $print [consume: ], n:char, [ 
+27     # read an integer from the channel
+28     n:char, eof?:bool, source <- read source
+29     break-if eof?
+30     # other threads might get between these prints
+31     $print [consume: ], n:char, [ 
 32 ]
-33   ¦ loop
+33     loop
 34   }
 35 ]
 36 
-37 def main [
+37 def main [
 38   local-scope
-39   source:&:source:char, sink:&:sink:char <- new-channel 3/capacity
+39   source:&:source:char, sink:&:sink:char <- new-channel 3/capacity
 40   # create two background 'routines' that communicate by a channel
-41   routine1:num <- start-running producer, sink
-42   routine2:num <- start-running consumer, source
+41   routine1:num <- start-running producer, sink
+42   routine2:num <- start-running consumer, source
 43   wait-for-routine routine1
 44   wait-for-routine routine2
 45 ]
-- 
cgit 1.4.1-2-gfad0