diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2017-12-03 23:25:40 -0800 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2017-12-03 23:25:40 -0800 |
commit | 4a48bedcd1d708a43d43dc6259a4e45c52ea3d00 (patch) | |
tree | 85c1b7310cca932797d727a3de8da96eb175d8da /html/065duplex_list.mu.html | |
parent | ef7d834fdd826977cd8d43253052a7b8e1c5aa72 (diff) | |
download | mu-4a48bedcd1d708a43d43dc6259a4e45c52ea3d00.tar.gz |
4134 - 'input' = 'ingredient'
Diffstat (limited to 'html/065duplex_list.mu.html')
-rw-r--r-- | html/065duplex_list.mu.html | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/html/065duplex_list.mu.html b/html/065duplex_list.mu.html index d01d6819..e0bde027 100644 --- a/html/065duplex_list.mu.html +++ b/html/065duplex_list.mu.html @@ -70,7 +70,7 @@ if ('onhashchange' in window) { <span id="L8" class="LineNr"> 8 </span> <span id="L9" class="LineNr"> 9 </span><span class="muRecipe">def</span> push x:_elem, in:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem/contained-in:result<span class="muRecipe"> -> </span>result:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem [ <span id="L10" class="LineNr"> 10 </span> <span class="Constant">local-scope</span> -<span id="L11" class="LineNr"> 11 </span> <span class="Constant">load-ingredients</span> +<span id="L11" class="LineNr"> 11 </span> <span class="Constant">load-inputs</span> <span id="L12" class="LineNr"> 12 </span> result:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem <span class="Special"><-</span> new <span class="Delimiter">{</span>(duplex-list _elem): type<span class="Delimiter">}</span> <span id="L13" class="LineNr"> 13 </span> *result <span class="Special"><-</span> merge x, in,<span class="Constant"> 0</span> <span id="L14" class="LineNr"> 14 </span> <span class="muControl">return-unless</span> in @@ -79,21 +79,21 @@ if ('onhashchange' in window) { <span id="L17" class="LineNr"> 17 </span> <span id="L18" class="LineNr"> 18 </span><span class="muRecipe">def</span> first in:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem<span class="muRecipe"> -> </span>result:_elem [ <span id="L19" class="LineNr"> 19 </span> <span class="Constant">local-scope</span> -<span id="L20" class="LineNr"> 20 </span> <span class="Constant">load-ingredients</span> +<span id="L20" class="LineNr"> 20 </span> <span class="Constant">load-inputs</span> <span id="L21" class="LineNr"> 21 </span> <span class="muControl">return-unless</span> in,<span class="Constant"> 0</span> <span id="L22" class="LineNr"> 22 </span> result <span class="Special"><-</span> get *in, <span class="Constant">value:offset</span> <span id="L23" class="LineNr"> 23 </span>] <span id="L24" class="LineNr"> 24 </span> <span id="L25" class="LineNr"> 25 </span><span class="muRecipe">def</span> <a href='065duplex_list.mu.html#L25'>next</a> in:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem<span class="muRecipe"> -> </span>result:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem/contained-in:in [ <span id="L26" class="LineNr"> 26 </span> <span class="Constant">local-scope</span> -<span id="L27" class="LineNr"> 27 </span> <span class="Constant">load-ingredients</span> +<span id="L27" class="LineNr"> 27 </span> <span class="Constant">load-inputs</span> <span id="L28" class="LineNr"> 28 </span> <span class="muControl">return-unless</span> in,<span class="Constant"> 0</span> <span id="L29" class="LineNr"> 29 </span> result <span class="Special"><-</span> get *in, <span class="Constant"><a href='065duplex_list.mu.html#L25'>next</a>:offset</span> <span id="L30" class="LineNr"> 30 </span>] <span id="L31" class="LineNr"> 31 </span> <span id="L32" class="LineNr"> 32 </span><span class="muRecipe">def</span> <a href='065duplex_list.mu.html#L32'>prev</a> in:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem<span class="muRecipe"> -> </span>result:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem/contained-in:in [ <span id="L33" class="LineNr"> 33 </span> <span class="Constant">local-scope</span> -<span id="L34" class="LineNr"> 34 </span> <span class="Constant">load-ingredients</span> +<span id="L34" class="LineNr"> 34 </span> <span class="Constant">load-inputs</span> <span id="L35" class="LineNr"> 35 </span> <span class="muControl">return-unless</span> in,<span class="Constant"> 0</span> <span id="L36" class="LineNr"> 36 </span> result <span class="Special"><-</span> get *in, <span class="Constant"><a href='065duplex_list.mu.html#L32'>prev</a>:offset</span> <span id="L37" class="LineNr"> 37 </span> <span class="muControl">return</span> result @@ -143,7 +143,7 @@ if ('onhashchange' in window) { <span id="L81" class="LineNr"> 81 </span> <span id="L82" class="LineNr"> 82 </span><span class="muRecipe">def</span> length l:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem<span class="muRecipe"> -> </span>result:num [ <span id="L83" class="LineNr"> 83 </span> <span class="Constant">local-scope</span> -<span id="L84" class="LineNr"> 84 </span> <span class="Constant">load-ingredients</span> +<span id="L84" class="LineNr"> 84 </span> <span class="Constant">load-inputs</span> <span id="L85" class="LineNr"> 85 </span> result <span class="Special"><-</span> copy<span class="Constant"> 0</span> <span id="L86" class="LineNr"> 86 </span> <span class="Delimiter">{</span> <span id="L87" class="LineNr"> 87 </span> <span class="Conceal">¦</span> <span class="muControl">break-unless</span> l @@ -156,7 +156,7 @@ if ('onhashchange' in window) { <span id="L94" class="LineNr"> 94 </span><span class="Comment"># insert 'x' after 'in'</span> <span id="L95" class="LineNr"> 95 </span><span class="muRecipe">def</span> insert x:_elem, in:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem<span class="muRecipe"> -> </span>in:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem [ <span id="L96" class="LineNr"> 96 </span> <span class="Constant">local-scope</span> -<span id="L97" class="LineNr"> 97 </span> <span class="Constant">load-ingredients</span> +<span id="L97" class="LineNr"> 97 </span> <span class="Constant">load-inputs</span> <span id="L98" class="LineNr"> 98 </span> new-node:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem <span class="Special"><-</span> new <span class="Delimiter">{</span>(duplex-list _elem): type<span class="Delimiter">}</span> <span id="L99" class="LineNr"> 99 </span> *new-node <span class="Special"><-</span> put *new-node, <span class="Constant">value:offset</span>, x <span id="L100" class="LineNr">100 </span> <span class="Comment"># save old next before changing it</span> @@ -285,7 +285,7 @@ if ('onhashchange' in window) { <span id="L223" class="LineNr">223 </span><span class="Comment"># pointers to the head are now invalid.</span> <span id="L224" class="LineNr">224 </span><span class="muRecipe">def</span> remove x:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem/contained-in:in, in:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem<span class="muRecipe"> -> </span>in:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem [ <span id="L225" class="LineNr">225 </span> <span class="Constant">local-scope</span> -<span id="L226" class="LineNr">226 </span> <span class="Constant">load-ingredients</span> +<span id="L226" class="LineNr">226 </span> <span class="Constant">load-inputs</span> <span id="L227" class="LineNr">227 </span> <span class="Comment"># if 'x' is null, return</span> <span id="L228" class="LineNr">228 </span> <span class="muControl">return-unless</span> x <span id="L229" class="LineNr">229 </span> next-node:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem <span class="Special"><-</span> get *x, <span class="Constant"><a href='065duplex_list.mu.html#L25'>next</a>:offset</span> @@ -409,7 +409,7 @@ if ('onhashchange' in window) { <span id="L347" class="LineNr">347 </span> <span id="L348" class="LineNr">348 </span><span class="muRecipe">def</span> remove x:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem/contained-in:in, n:num, in:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem<span class="muRecipe"> -> </span>in:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem [ <span id="L349" class="LineNr">349 </span> <span class="Constant">local-scope</span> -<span id="L350" class="LineNr">350 </span> <span class="Constant">load-ingredients</span> +<span id="L350" class="LineNr">350 </span> <span class="Constant">load-inputs</span> <span id="L351" class="LineNr">351 </span> i:num <span class="Special"><-</span> copy<span class="Constant"> 0</span> <span id="L352" class="LineNr">352 </span> curr:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem <span class="Special"><-</span> copy x <span id="L353" class="LineNr">353 </span> <span class="Delimiter">{</span> @@ -446,7 +446,7 @@ if ('onhashchange' in window) { <span id="L384" class="LineNr">384 </span><span class="Comment"># clean way to return the new head pointer.</span> <span id="L385" class="LineNr">385 </span><span class="muRecipe">def</span> <a href='065duplex_list.mu.html#L385'>remove-between</a> start:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem, end:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem/contained-in:start<span class="muRecipe"> -> </span>start:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem [ <span id="L386" class="LineNr">386 </span> <span class="Constant">local-scope</span> -<span id="L387" class="LineNr">387 </span> <span class="Constant">load-ingredients</span> +<span id="L387" class="LineNr">387 </span> <span class="Constant">load-inputs</span> <span id="L388" class="LineNr">388 </span> <a href='065duplex_list.mu.html#L25'>next</a>:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem <span class="Special"><-</span> get *start, <span class="Constant"><a href='065duplex_list.mu.html#L25'>next</a>:offset</span> <span id="L389" class="LineNr">389 </span> nothing-to-delete?:bool <span class="Special"><-</span> equal <a href='065duplex_list.mu.html#L25'>next</a>, end <span id="L390" class="LineNr">390 </span> <span class="muControl">return-if</span> nothing-to-delete? @@ -586,7 +586,7 @@ if ('onhashchange' in window) { <span id="L524" class="LineNr">524 </span><span class="Comment"># insert list beginning at 'start' after 'in'</span> <span id="L525" class="LineNr">525 </span><span class="muRecipe">def</span> <a href='065duplex_list.mu.html#L525'>splice</a> in:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem, start:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem/contained-in:in<span class="muRecipe"> -> </span>in:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem [ <span id="L526" class="LineNr">526 </span> <span class="Constant">local-scope</span> -<span id="L527" class="LineNr">527 </span> <span class="Constant">load-ingredients</span> +<span id="L527" class="LineNr">527 </span> <span class="Constant">load-inputs</span> <span id="L528" class="LineNr">528 </span> <span class="muControl">return-unless</span> in <span id="L529" class="LineNr">529 </span> <span class="muControl">return-unless</span> start <span id="L530" class="LineNr">530 </span> end:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem <span class="Special"><-</span> <a href='065duplex_list.mu.html#L572'>last</a> start @@ -603,7 +603,7 @@ if ('onhashchange' in window) { <span id="L541" class="LineNr">541 </span><span class="Comment"># insert contents of 'new' after 'in'</span> <span id="L542" class="LineNr">542 </span><span class="muRecipe">def</span> insert in:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem, new:&:@:_elem<span class="muRecipe"> -> </span>in:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem [ <span id="L543" class="LineNr">543 </span> <span class="Constant">local-scope</span> -<span id="L544" class="LineNr">544 </span> <span class="Constant">load-ingredients</span> +<span id="L544" class="LineNr">544 </span> <span class="Constant">load-inputs</span> <span id="L545" class="LineNr">545 </span> <span class="muControl">return-unless</span> in <span id="L546" class="LineNr">546 </span> <span class="muControl">return-unless</span> new <span id="L547" class="LineNr">547 </span> len:num <span class="Special"><-</span> length *new @@ -624,7 +624,7 @@ if ('onhashchange' in window) { <span id="L562" class="LineNr">562 </span> <span id="L563" class="LineNr">563 </span><span class="muRecipe">def</span> append in:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem, new:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem/contained-in:in<span class="muRecipe"> -> </span>in:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem [ <span id="L564" class="LineNr">564 </span> <span class="Constant">local-scope</span> -<span id="L565" class="LineNr">565 </span> <span class="Constant">load-ingredients</span> +<span id="L565" class="LineNr">565 </span> <span class="Constant">load-inputs</span> <span id="L566" class="LineNr">566 </span> <a href='065duplex_list.mu.html#L572'>last</a>:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem <span class="Special"><-</span> <a href='065duplex_list.mu.html#L572'>last</a> in <span id="L567" class="LineNr">567 </span> *last <span class="Special"><-</span> put *last, <span class="Constant"><a href='065duplex_list.mu.html#L25'>next</a>:offset</span>, new <span id="L568" class="LineNr">568 </span> <span class="muControl">return-unless</span> new @@ -633,7 +633,7 @@ if ('onhashchange' in window) { <span id="L571" class="LineNr">571 </span> <span id="L572" class="LineNr">572 </span><span class="muRecipe">def</span> <a href='065duplex_list.mu.html#L572'>last</a> in:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem<span class="muRecipe"> -> </span>result:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem [ <span id="L573" class="LineNr">573 </span> <span class="Constant">local-scope</span> -<span id="L574" class="LineNr">574 </span> <span class="Constant">load-ingredients</span> +<span id="L574" class="LineNr">574 </span> <span class="Constant">load-inputs</span> <span id="L575" class="LineNr">575 </span> result <span class="Special"><-</span> copy in <span id="L576" class="LineNr">576 </span> <span class="Delimiter">{</span> <span id="L577" class="LineNr">577 </span> <span class="Conceal">¦</span> <a href='065duplex_list.mu.html#L25'>next</a>:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem <span class="Special"><-</span> <a href='065duplex_list.mu.html#L25'>next</a> result @@ -646,7 +646,7 @@ if ('onhashchange' in window) { <span id="L584" class="LineNr">584 </span><span class="Comment"># does a duplex list start with a certain sequence of elements?</span> <span id="L585" class="LineNr">585 </span><span class="muRecipe">def</span> <a href='065duplex_list.mu.html#L585'>match</a> x:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem, y:&:@:_elem<span class="muRecipe"> -> </span>result:bool [ <span id="L586" class="LineNr">586 </span> <span class="Constant">local-scope</span> -<span id="L587" class="LineNr">587 </span> <span class="Constant">load-ingredients</span> +<span id="L587" class="LineNr">587 </span> <span class="Constant">load-inputs</span> <span id="L588" class="LineNr">588 </span> i:num <span class="Special"><-</span> copy<span class="Constant"> 0</span> <span id="L589" class="LineNr">589 </span> max:num <span class="Special"><-</span> length *y <span id="L590" class="LineNr">590 </span> <span class="Delimiter">{</span> @@ -691,7 +691,7 @@ if ('onhashchange' in window) { <span id="L629" class="LineNr">629 </span><span class="Comment"># helper for debugging</span> <span id="L630" class="LineNr">630 </span><span class="muRecipe">def</span> <a href='065duplex_list.mu.html#L630'>dump-from</a> x:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem [ <span id="L631" class="LineNr">631 </span> <span class="Constant">local-scope</span> -<span id="L632" class="LineNr">632 </span> <span class="Constant">load-ingredients</span> +<span id="L632" class="LineNr">632 </span> <span class="Constant">load-inputs</span> <span id="L633" class="LineNr">633 </span> $print x, <span class="Constant">[: ]</span> <span id="L634" class="LineNr">634 </span> <span class="Delimiter">{</span> <span id="L635" class="LineNr">635 </span> <span class="Conceal">¦</span> <span class="muControl">break-unless</span> x @@ -724,7 +724,7 @@ if ('onhashchange' in window) { <span id="L662" class="LineNr">662 </span> <span id="L663" class="LineNr">663 </span><span class="muRecipe">def</span> to-text in:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem<span class="muRecipe"> -> </span>result:text [ <span id="L664" class="LineNr">664 </span> <span class="Constant">local-scope</span> -<span id="L665" class="LineNr">665 </span> <span class="Constant">load-ingredients</span> +<span id="L665" class="LineNr">665 </span> <span class="Constant">load-inputs</span> <span id="L666" class="LineNr">666 </span> buf:&:<a href='061text.mu.html#L120'>buffer</a>:char <span class="Special"><-</span> <a href='061text.mu.html#L125'>new-buffer</a><span class="Constant"> 80</span> <span id="L667" class="LineNr">667 </span> buf <span class="Special"><-</span> to-buffer in, buf <span id="L668" class="LineNr">668 </span> result <span class="Special"><-</span> <a href='061text.mu.html#L338'>buffer-to-array</a> buf @@ -733,7 +733,7 @@ if ('onhashchange' in window) { <span id="L671" class="LineNr">671 </span><span class="Comment"># variant of 'to-text' which stops printing after a few elements (and so is robust to cycles)</span> <span id="L672" class="LineNr">672 </span><span class="muRecipe">def</span> to-text-line in:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem<span class="muRecipe"> -> </span>result:text [ <span id="L673" class="LineNr">673 </span> <span class="Constant">local-scope</span> -<span id="L674" class="LineNr">674 </span> <span class="Constant">load-ingredients</span> +<span id="L674" class="LineNr">674 </span> <span class="Constant">load-inputs</span> <span id="L675" class="LineNr">675 </span> buf:&:<a href='061text.mu.html#L120'>buffer</a>:char <span class="Special"><-</span> <a href='061text.mu.html#L125'>new-buffer</a><span class="Constant"> 80</span> <span id="L676" class="LineNr">676 </span> buf <span class="Special"><-</span> to-buffer in, buf,<span class="Constant"> 6</span> <span class="Comment"># max elements to display</span> <span id="L677" class="LineNr">677 </span> result <span class="Special"><-</span> <a href='061text.mu.html#L338'>buffer-to-array</a> buf @@ -741,7 +741,7 @@ if ('onhashchange' in window) { <span id="L679" class="LineNr">679 </span> <span id="L680" class="LineNr">680 </span><span class="muRecipe">def</span> to-buffer in:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem, buf:&:<a href='061text.mu.html#L120'>buffer</a>:char<span class="muRecipe"> -> </span>buf:&:<a href='061text.mu.html#L120'>buffer</a>:char [ <span id="L681" class="LineNr">681 </span> <span class="Constant">local-scope</span> -<span id="L682" class="LineNr">682 </span> <span class="Constant">load-ingredients</span> +<span id="L682" class="LineNr">682 </span> <span class="Constant">load-inputs</span> <span id="L683" class="LineNr">683 </span> <span class="Delimiter">{</span> <span id="L684" class="LineNr">684 </span> <span class="Conceal">¦</span> <span class="muControl">break-if</span> in <span id="L685" class="LineNr">685 </span> <span class="Conceal">¦</span> buf <span class="Special"><-</span> append buf, <span class="Constant">[[]</span>] @@ -756,9 +756,9 @@ if ('onhashchange' in window) { <span id="L694" class="LineNr">694 </span> <span class="muControl">return-unless</span> <a href='065duplex_list.mu.html#L25'>next</a> <span id="L695" class="LineNr">695 </span> buf <span class="Special"><-</span> append buf, <span class="Constant">[ <-> ]</span> <span id="L696" class="LineNr">696 </span> <span class="Comment"># and recurse</span> -<span id="L697" class="LineNr">697 </span> remaining:num, optional-ingredient-found?:bool <span class="Special"><-</span> <span class="Constant">next-ingredient</span> +<span id="L697" class="LineNr">697 </span> remaining:num, optional-input-found?:bool <span class="Special"><-</span> <span class="Constant">next-input</span> <span id="L698" class="LineNr">698 </span> <span class="Delimiter">{</span> -<span id="L699" class="LineNr">699 </span> <span class="Conceal">¦</span> <span class="muControl">break-if</span> optional-ingredient-found? +<span id="L699" class="LineNr">699 </span> <span class="Conceal">¦</span> <span class="muControl">break-if</span> optional-input-found? <span id="L700" class="LineNr">700 </span> <span class="Conceal">¦</span> <span class="Comment"># unlimited recursion</span> <span id="L701" class="LineNr">701 </span> <span class="Conceal">¦</span> buf <span class="Special"><-</span> to-buffer <a href='065duplex_list.mu.html#L25'>next</a>, buf <span id="L702" class="LineNr">702 </span> <span class="Conceal">¦</span> <span class="muControl">return</span> |