about summary refs log tree commit diff stats
path: root/html/075channel.mu.html
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2017-12-03 23:25:40 -0800
committerKartik K. Agaram <vc@akkartik.com>2017-12-03 23:25:40 -0800
commit4a48bedcd1d708a43d43dc6259a4e45c52ea3d00 (patch)
tree85c1b7310cca932797d727a3de8da96eb175d8da /html/075channel.mu.html
parentef7d834fdd826977cd8d43253052a7b8e1c5aa72 (diff)
downloadmu-4a48bedcd1d708a43d43dc6259a4e45c52ea3d00.tar.gz
4134 - 'input' = 'ingredient'
Diffstat (limited to 'html/075channel.mu.html')
-rw-r--r--html/075channel.mu.html26
1 files changed, 13 insertions, 13 deletions
diff --git a/html/075channel.mu.html b/html/075channel.mu.html
index 91122080..c543311e 100644
--- a/html/075channel.mu.html
+++ b/html/075channel.mu.html
@@ -74,9 +74,9 @@ if ('onhashchange' in window) {
 <span id="L10" class="LineNr"> 10 </span><span class="Comment">#   addresses from being shared between routines, and therefore eliminates all</span>
 <span id="L11" class="LineNr"> 11 </span><span class="Comment">#   possibility of race conditions.</span>
 <span id="L12" class="LineNr"> 12 </span><span class="Comment">#</span>
-<span id="L13" class="LineNr"> 13 </span><span class="Comment"># There's still a narrow window for race conditions: the ingredients passed in</span>
+<span id="L13" class="LineNr"> 13 </span><span class="Comment"># There's still a narrow window for race conditions: the inputs passed in</span>
 <span id="L14" class="LineNr"> 14 </span><span class="Comment"># to 'start-running'. Pass only channels into routines and you should be fine.</span>
-<span id="L15" class="LineNr"> 15 </span><span class="Comment"># Any other mutable ingredients will require locks.</span>
+<span id="L15" class="LineNr"> 15 </span><span class="Comment"># Any other mutable inputs will require locks.</span>
 <span id="L16" class="LineNr"> 16 </span>
 <span id="L17" class="LineNr"> 17 </span><span class="muScenario">scenario</span> channel [
 <span id="L18" class="LineNr"> 18 </span>  run [
@@ -114,7 +114,7 @@ if ('onhashchange' in window) {
 <span id="L50" class="LineNr"> 50 </span>
 <span id="L51" class="LineNr"> 51 </span><span class="muRecipe">def</span> <a href='075channel.mu.html#L51'>new-channel</a> <a href='075channel.mu.html#L399'>capacity</a>:num<span class="muRecipe"> -&gt; </span>in:&amp;:<a href='075channel.mu.html#L43'>source</a>:_elem, out:&amp;:<a href='075channel.mu.html#L47'>sink</a>:_elem [
 <span id="L52" class="LineNr"> 52 </span>  <span class="Constant">local-scope</span>
-<span id="L53" class="LineNr"> 53 </span>  <span class="Constant">load-ingredients</span>
+<span id="L53" class="LineNr"> 53 </span>  <span class="Constant">load-inputs</span>
 <span id="L54" class="LineNr"> 54 </span>  result:&amp;:channel:_elem <span class="Special">&lt;-</span> new <span class="Delimiter">{</span>(channel _elem): type<span class="Delimiter">}</span>
 <span id="L55" class="LineNr"> 55 </span>  *result <span class="Special">&lt;-</span> put *result, <span class="Constant">first-full:offset</span>,<span class="Constant"> 0</span>
 <span id="L56" class="LineNr"> 56 </span>  *result <span class="Special">&lt;-</span> put *result, <span class="Constant">first-free:offset</span>,<span class="Constant"> 0</span>
@@ -130,7 +130,7 @@ if ('onhashchange' in window) {
 <span id="L66" class="LineNr"> 66 </span><span class="Comment"># write a value to a channel</span>
 <span id="L67" class="LineNr"> 67 </span><span class="muRecipe">def</span> <a href='075channel.mu.html#L67'>write</a> out:&amp;:<a href='075channel.mu.html#L47'>sink</a>:_elem, val:_elem<span class="muRecipe"> -&gt; </span>out:&amp;:<a href='075channel.mu.html#L47'>sink</a>:_elem [
 <span id="L68" class="LineNr"> 68 </span>  <span class="Constant">local-scope</span>
-<span id="L69" class="LineNr"> 69 </span>  <span class="Constant">load-ingredients</span>
+<span id="L69" class="LineNr"> 69 </span>  <span class="Constant">load-inputs</span>
 <span id="L70" class="LineNr"> 70 </span>  assert out, <span class="Constant">[write to null channel]</span>
 <span id="L71" class="LineNr"> 71 </span>  chan:&amp;:channel:_elem <span class="Special">&lt;-</span> get *out, <span class="Constant">chan:offset</span>
 <span id="L72" class="LineNr"> 72 </span><span class="Constant">  <a href='075channel.mu.html#L72'>&lt;channel-write-initial&gt;</a></span>
@@ -176,7 +176,7 @@ if ('onhashchange' in window) {
 <span id="L112" class="LineNr">112 </span><span class="Comment"># read a value from a channel</span>
 <span id="L113" class="LineNr">113 </span><span class="muRecipe">def</span> read in:&amp;:<a href='075channel.mu.html#L43'>source</a>:_elem<span class="muRecipe"> -&gt; </span>result:_elem, eof?:bool, in:&amp;:<a href='075channel.mu.html#L43'>source</a>:_elem [
 <span id="L114" class="LineNr">114 </span>  <span class="Constant">local-scope</span>
-<span id="L115" class="LineNr">115 </span>  <span class="Constant">load-ingredients</span>
+<span id="L115" class="LineNr">115 </span>  <span class="Constant">load-inputs</span>
 <span id="L116" class="LineNr">116 </span>  assert in, <span class="Constant">[read on null channel]</span>
 <span id="L117" class="LineNr">117 </span>  eof? <span class="Special">&lt;-</span> copy <span class="Constant">0/false</span>  <span class="Comment"># default result</span>
 <span id="L118" class="LineNr">118 </span>  chan:&amp;:channel:_elem <span class="Special">&lt;-</span> get *in, <span class="Constant">chan:offset</span>
@@ -375,7 +375,7 @@ if ('onhashchange' in window) {
 <span id="L311" class="LineNr">311 </span>
 <span id="L312" class="LineNr">312 </span><span class="muRecipe">def</span> <a href='075channel.mu.html#L312'>clear</a> in:&amp;:<a href='075channel.mu.html#L43'>source</a>:_elem<span class="muRecipe"> -&gt; </span>in:&amp;:<a href='075channel.mu.html#L43'>source</a>:_elem [
 <span id="L313" class="LineNr">313 </span>  <span class="Constant">local-scope</span>
-<span id="L314" class="LineNr">314 </span>  <span class="Constant">load-ingredients</span>
+<span id="L314" class="LineNr">314 </span>  <span class="Constant">load-inputs</span>
 <span id="L315" class="LineNr">315 </span>  chan:&amp;:channel:_elem <span class="Special">&lt;-</span> get *in, <span class="Constant">chan:offset</span>
 <span id="L316" class="LineNr">316 </span>  <span class="Delimiter">{</span>
 <span id="L317" class="LineNr">317 </span>  <span class="Conceal">¦</span> empty?:bool <span class="Special">&lt;-</span> <a href='075channel.mu.html#L370'>channel-empty?</a> chan
@@ -397,13 +397,13 @@ if ('onhashchange' in window) {
 <span id="L333" class="LineNr">333 </span><span class="Comment"># both routines can modify the 'closed?' bit, but they can only ever set it, so this is a benign race</span>
 <span id="L334" class="LineNr">334 </span><span class="muRecipe">def</span> close x:&amp;:<a href='075channel.mu.html#L43'>source</a>:_elem<span class="muRecipe"> -&gt; </span>x:&amp;:<a href='075channel.mu.html#L43'>source</a>:_elem [
 <span id="L335" class="LineNr">335 </span>  <span class="Constant">local-scope</span>
-<span id="L336" class="LineNr">336 </span>  <span class="Constant">load-ingredients</span>
+<span id="L336" class="LineNr">336 </span>  <span class="Constant">load-inputs</span>
 <span id="L337" class="LineNr">337 </span>  chan:&amp;:channel:_elem <span class="Special">&lt;-</span> get *x, <span class="Constant">chan:offset</span>
 <span id="L338" class="LineNr">338 </span>  *chan <span class="Special">&lt;-</span> put *chan, <span class="Constant">closed?:offset</span>, <span class="Constant">1/true</span>
 <span id="L339" class="LineNr">339 </span>]
 <span id="L340" class="LineNr">340 </span><span class="muRecipe">def</span> close x:&amp;:<a href='075channel.mu.html#L47'>sink</a>:_elem<span class="muRecipe"> -&gt; </span>x:&amp;:<a href='075channel.mu.html#L47'>sink</a>:_elem [
 <span id="L341" class="LineNr">341 </span>  <span class="Constant">local-scope</span>
-<span id="L342" class="LineNr">342 </span>  <span class="Constant">load-ingredients</span>
+<span id="L342" class="LineNr">342 </span>  <span class="Constant">load-inputs</span>
 <span id="L343" class="LineNr">343 </span>  chan:&amp;:channel:_elem <span class="Special">&lt;-</span> get *x, <span class="Constant">chan:offset</span>
 <span id="L344" class="LineNr">344 </span>  *chan <span class="Special">&lt;-</span> put *chan, <span class="Constant">closed?:offset</span>, <span class="Constant">1/true</span>
 <span id="L345" class="LineNr">345 </span>]
@@ -433,7 +433,7 @@ if ('onhashchange' in window) {
 <span id="L369" class="LineNr">369 </span><span class="Comment"># An empty channel has first-free and first-full both at the same value.</span>
 <span id="L370" class="LineNr">370 </span><span class="muRecipe">def</span> <a href='075channel.mu.html#L370'>channel-empty?</a> chan:&amp;:channel:_elem<span class="muRecipe"> -&gt; </span>result:bool [
 <span id="L371" class="LineNr">371 </span>  <span class="Constant">local-scope</span>
-<span id="L372" class="LineNr">372 </span>  <span class="Constant">load-ingredients</span>
+<span id="L372" class="LineNr">372 </span>  <span class="Constant">load-inputs</span>
 <span id="L373" class="LineNr">373 </span>  <span class="Comment"># return chan.first-full == chan.first-free</span>
 <span id="L374" class="LineNr">374 </span>  full:num <span class="Special">&lt;-</span> get *chan, <span class="Constant">first-full:offset</span>
 <span id="L375" class="LineNr">375 </span>  free:num <span class="Special">&lt;-</span> get *chan, <span class="Constant">first-free:offset</span>
@@ -444,7 +444,7 @@ if ('onhashchange' in window) {
 <span id="L380" class="LineNr">380 </span><span class="Comment"># (Other alternatives: <a href="https://www.snellman.net/blog/archive/2016-12-13-ring-buffers">https://www.snellman.net/blog/archive/2016-12-13-ring-buffers</a>)</span>
 <span id="L381" class="LineNr">381 </span><span class="muRecipe">def</span> <a href='075channel.mu.html#L381'>channel-full?</a> chan:&amp;:channel:_elem<span class="muRecipe"> -&gt; </span>result:bool [
 <span id="L382" class="LineNr">382 </span>  <span class="Constant">local-scope</span>
-<span id="L383" class="LineNr">383 </span>  <span class="Constant">load-ingredients</span>
+<span id="L383" class="LineNr">383 </span>  <span class="Constant">load-inputs</span>
 <span id="L384" class="LineNr">384 </span>  <span class="Comment"># tmp = chan.first-free + 1</span>
 <span id="L385" class="LineNr">385 </span>  tmp:num <span class="Special">&lt;-</span> get *chan, <span class="Constant">first-free:offset</span>
 <span id="L386" class="LineNr">386 </span>  tmp <span class="Special">&lt;-</span> add tmp,<span class="Constant"> 1</span>
@@ -462,7 +462,7 @@ if ('onhashchange' in window) {
 <span id="L398" class="LineNr">398 </span>
 <span id="L399" class="LineNr">399 </span><span class="muRecipe">def</span> <a href='075channel.mu.html#L399'>capacity</a> chan:&amp;:channel:_elem<span class="muRecipe"> -&gt; </span>result:num [
 <span id="L400" class="LineNr">400 </span>  <span class="Constant">local-scope</span>
-<span id="L401" class="LineNr">401 </span>  <span class="Constant">load-ingredients</span>
+<span id="L401" class="LineNr">401 </span>  <span class="Constant">load-inputs</span>
 <span id="L402" class="LineNr">402 </span>  q:&amp;:@:_elem <span class="Special">&lt;-</span> get *chan, <span class="Constant">data:offset</span>
 <span id="L403" class="LineNr">403 </span>  result <span class="Special">&lt;-</span> length *q
 <span id="L404" class="LineNr">404 </span>]
@@ -471,7 +471,7 @@ if ('onhashchange' in window) {
 <span id="L407" class="LineNr">407 </span>
 <span id="L408" class="LineNr">408 </span><span class="muRecipe">def</span> <a href='075channel.mu.html#L408'>buffer-lines</a> in:&amp;:<a href='075channel.mu.html#L43'>source</a>:char, buffered-out:&amp;:<a href='075channel.mu.html#L47'>sink</a>:char<span class="muRecipe"> -&gt; </span>buffered-out:&amp;:<a href='075channel.mu.html#L47'>sink</a>:char, in:&amp;:<a href='075channel.mu.html#L43'>source</a>:char [
 <span id="L409" class="LineNr">409 </span>  <span class="Constant">local-scope</span>
-<span id="L410" class="LineNr">410 </span>  <span class="Constant">load-ingredients</span>
+<span id="L410" class="LineNr">410 </span>  <span class="Constant">load-inputs</span>
 <span id="L411" class="LineNr">411 </span>  <span class="Comment"># repeat forever</span>
 <span id="L412" class="LineNr">412 </span>  eof?:bool <span class="Special">&lt;-</span> copy <span class="Constant">0/false</span>
 <span id="L413" class="LineNr">413 </span>  <span class="Delimiter">{</span>
@@ -570,7 +570,7 @@ if ('onhashchange' in window) {
 <span id="L506" class="LineNr">506 </span>
 <span id="L507" class="LineNr">507 </span><span class="muRecipe">def</span> <a href='075channel.mu.html#L507'>drain</a> <a href='075channel.mu.html#L43'>source</a>:&amp;:<a href='075channel.mu.html#L43'>source</a>:char<span class="muRecipe"> -&gt; </span>result:text, <a href='075channel.mu.html#L43'>source</a>:&amp;:<a href='075channel.mu.html#L43'>source</a>:char [
 <span id="L508" class="LineNr">508 </span>  <span class="Constant">local-scope</span>
-<span id="L509" class="LineNr">509 </span>  <span class="Constant">load-ingredients</span>
+<span id="L509" class="LineNr">509 </span>  <span class="Constant">load-inputs</span>
 <span id="L510" class="LineNr">510 </span>  buf:&amp;:<a href='061text.mu.html#L120'>buffer</a>:char <span class="Special">&lt;-</span> <a href='061text.mu.html#L125'>new-buffer</a><span class="Constant"> 30</span>
 <span id="L511" class="LineNr">511 </span>  <span class="Delimiter">{</span>
 <span id="L512" class="LineNr">512 </span>  <span class="Conceal">¦</span> c:char, done?:bool <span class="Special">&lt;-</span> read <a href='075channel.mu.html#L43'>source</a>