diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2015-07-29 15:55:05 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2015-07-29 15:55:05 -0700 |
commit | 9570363aec35e187e2395b1760a4b94e71580ac9 (patch) | |
tree | 5b0d9cf65b5d5a403ab29e88535ba158efb276fe /html/channel.mu.html | |
parent | b318b7fb127a2bdf3e394b315a45d339dc738447 (diff) | |
download | mu-9570363aec35e187e2395b1760a4b94e71580ac9.tar.gz |
1885
Diffstat (limited to 'html/channel.mu.html')
-rw-r--r-- | html/channel.mu.html | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/html/channel.mu.html b/html/channel.mu.html index 40a058af..45450112 100644 --- a/html/channel.mu.html +++ b/html/channel.mu.html @@ -13,12 +13,12 @@ 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; } .Delimiter { color: #a04060; } .Comment { color: #9090ff; } .Constant { color: #00a0a0; } .Special { color: #ff6060; } .muControl { color: #c0a020; } -.muRecipe { color: #ff8700; } --> </style> @@ -37,15 +37,15 @@ body { font-family: monospace; color: #eeeeee; background-color: #080808; } <span class="Constant">local-scope</span> chan:address:channel<span class="Special"> <- </span><span class="Constant">next-ingredient</span> <span class="Comment"># n = 0</span> - n:number<span class="Special"> <- </span>copy <span class="Constant">0:literal</span> + n:number<span class="Special"> <- </span>copy <span class="Constant">0</span> <span class="Delimiter">{</span> - done?:boolean<span class="Special"> <- </span>lesser-than n:number, <span class="Constant">5:literal</span> - <span class="muControl">break-unless</span> done?:boolean + done?:boolean<span class="Special"> <- </span>lesser-than n, <span class="Constant">5</span> + <span class="muControl">break-unless</span> done? <span class="Comment"># other threads might get between these prints</span> - $print <span class="Constant">[produce: ]</span>, n:number, <span class="Constant">[ </span> + $print <span class="Constant">[produce: ]</span>, n, <span class="Constant">[ </span> <span class="Constant">]</span> - chan:address:channel<span class="Special"> <- </span>write chan:address:channel, n:number - n:number<span class="Special"> <- </span>add n:number, <span class="Constant">1:literal</span> + chan:address:channel<span class="Special"> <- </span>write chan, n + n<span class="Special"> <- </span>add n, <span class="Constant">1</span> <span class="muControl">loop</span> <span class="Delimiter">}</span> ] @@ -56,7 +56,7 @@ body { font-family: monospace; color: #eeeeee; background-color: #080808; } chan:address:channel<span class="Special"> <- </span><span class="Constant">next-ingredient</span> <span class="Delimiter">{</span> <span class="Comment"># read an integer from the channel</span> - n:number, chan:address:channel<span class="Special"> <- </span>read chan:address:channel + n:number, chan:address:channel<span class="Special"> <- </span>read chan <span class="Comment"># other threads might get between these prints</span> $print <span class="Constant">[consume: ]</span>, n:number, <span class="Constant">[ </span> <span class="Constant">]</span> @@ -66,12 +66,12 @@ body { font-family: monospace; color: #eeeeee; background-color: #080808; } <span class="muRecipe">recipe</span> main [ <span class="Constant">local-scope</span> - chan:address:channel<span class="Special"> <- </span>new-channel <span class="Constant">3:literal</span> + chan:address:channel<span class="Special"> <- </span>new-channel <span class="Constant">3</span> <span class="Comment"># create two background 'routines' that communicate by a channel</span> - routine1:number<span class="Special"> <- </span>start-running producer:<span class="muRecipe">recipe</span>, chan:address:channel - routine2:number<span class="Special"> <- </span>start-running consumer:<span class="muRecipe">recipe</span>, chan:address:channel - wait-for-routine routine1:number - wait-for-routine routine2:number + routine1:number<span class="Special"> <- </span>start-running producer:<span class="muRecipe">recipe</span>, chan + routine2:number<span class="Special"> <- </span>start-running consumer:<span class="muRecipe">recipe</span>, chan + wait-for-routine routine1 + wait-for-routine routine2 ] </pre> </body> |