diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2016-04-25 22:27:19 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2016-04-25 22:27:19 -0700 |
commit | 32b8fac2799ac7cec613e84a3eb9c009141b6a3a (patch) | |
tree | 11f56c1a235abf7b626ea8983fff3d2edb1fcf98 /html/074list.mu.html | |
parent | 224972ee9871fcb06ee285fa5f3d9528c034d414 (diff) | |
download | mu-32b8fac2799ac7cec613e84a3eb9c009141b6a3a.tar.gz |
2866
Diffstat (limited to 'html/074list.mu.html')
-rw-r--r-- | html/074list.mu.html | 45 |
1 files changed, 21 insertions, 24 deletions
diff --git a/html/074list.mu.html b/html/074list.mu.html index 76b64ad5..bb619f3e 100644 --- a/html/074list.mu.html +++ b/html/074list.mu.html @@ -39,27 +39,24 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="muData">container</span> list:_elem [ value:_elem - next:address:shared:list:_elem + next:address:list:_elem ] -<span class="muRecipe">def</span> push x:_elem, in:address:shared:list:_elem<span class="muRecipe"> -> </span>in:address:shared:list:_elem [ +<span class="muRecipe">def</span> push x:_elem, in:address:list:_elem<span class="muRecipe"> -> </span>in:address:list:_elem [ <span class="Constant">local-scope</span> <span class="Constant">load-ingredients</span> - result:address:shared:list:_elem<span class="Special"> <- </span>new <span class="Delimiter">{</span>(list _elem): type<span class="Delimiter">}</span> - val:address:_elem<span class="Special"> <- </span>get-address *result, <span class="Constant">value:offset</span> - *val<span class="Special"> <- </span>copy x - next:address:address:shared:list:_elem<span class="Special"> <- </span>get-address *result, <span class="Constant">next:offset</span> - *next<span class="Special"> <- </span>copy in + result:address:list:_elem<span class="Special"> <- </span>new <span class="Delimiter">{</span>(list _elem): type<span class="Delimiter">}</span> + *result<span class="Special"> <- </span>merge x, in <span class="muControl">return</span> result <span class="Comment"># needed explicitly because we need to replace 'in' with 'result'</span> ] -<span class="muRecipe">def</span> first in:address:shared:list:_elem<span class="muRecipe"> -> </span>result:_elem [ +<span class="muRecipe">def</span> first in:address:list:_elem<span class="muRecipe"> -> </span>result:_elem [ <span class="Constant">local-scope</span> <span class="Constant">load-ingredients</span> result<span class="Special"> <- </span>get *in, <span class="Constant">value:offset</span> ] -<span class="muRecipe">def</span> rest in:address:shared:list:_elem<span class="muRecipe"> -> </span>result:address:shared:list:_elem/contained-in:in [ +<span class="muRecipe">def</span> rest in:address:list:_elem<span class="muRecipe"> -> </span>result:address:list:_elem/contained-in:in [ <span class="Constant">local-scope</span> <span class="Constant">load-ingredients</span> result<span class="Special"> <- </span>get *in, <span class="Constant">next:offset</span> @@ -67,15 +64,15 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="muScenario">scenario</span> list-handling [ run [ - <span class="Constant">1</span>:address:shared:list:number<span class="Special"> <- </span>push <span class="Constant">3</span>, <span class="Constant">0</span> - <span class="Constant">1</span>:address:shared:list:number<span class="Special"> <- </span>push <span class="Constant">4</span>, <span class="Constant">1</span>:address:shared:list:number - <span class="Constant">1</span>:address:shared:list:number<span class="Special"> <- </span>push <span class="Constant">5</span>, <span class="Constant">1</span>:address:shared:list:number - <span class="Constant">2</span>:number<span class="Special"> <- </span>first <span class="Constant">1</span>:address:shared:list:number - <span class="Constant">1</span>:address:shared:list:number<span class="Special"> <- </span>rest <span class="Constant">1</span>:address:shared:list:number - <span class="Constant">3</span>:number<span class="Special"> <- </span>first <span class="Constant">1</span>:address:shared:list:number - <span class="Constant">1</span>:address:shared:list:number<span class="Special"> <- </span>rest <span class="Constant">1</span>:address:shared:list:number - <span class="Constant">4</span>:number<span class="Special"> <- </span>first <span class="Constant">1</span>:address:shared:list:number - <span class="Constant">1</span>:address:shared:list:number<span class="Special"> <- </span>rest <span class="Constant">1</span>:address:shared:list:number + <span class="Constant">1</span>:address:list:number<span class="Special"> <- </span>push <span class="Constant">3</span>, <span class="Constant">0</span> + <span class="Constant">1</span>:address:list:number<span class="Special"> <- </span>push <span class="Constant">4</span>, <span class="Constant">1</span>:address:list:number + <span class="Constant">1</span>:address:list:number<span class="Special"> <- </span>push <span class="Constant">5</span>, <span class="Constant">1</span>:address:list:number + <span class="Constant">2</span>:number<span class="Special"> <- </span>first <span class="Constant">1</span>:address:list:number + <span class="Constant">1</span>:address:list:number<span class="Special"> <- </span>rest <span class="Constant">1</span>:address:list:number + <span class="Constant">3</span>:number<span class="Special"> <- </span>first <span class="Constant">1</span>:address:list:number + <span class="Constant">1</span>:address:list:number<span class="Special"> <- </span>rest <span class="Constant">1</span>:address:list:number + <span class="Constant">4</span>:number<span class="Special"> <- </span>first <span class="Constant">1</span>:address:list:number + <span class="Constant">1</span>:address:list:number<span class="Special"> <- </span>rest <span class="Constant">1</span>:address:list:number ] memory-should-contain [ <span class="Constant">1</span><span class="Special"> <- </span><span class="Constant">0</span> <span class="Comment"># empty to empty, dust to dust..</span> @@ -85,24 +82,24 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] ] -<span class="muRecipe">def</span> to-text in:address:shared:list:_elem<span class="muRecipe"> -> </span>result:address:shared:array:character [ +<span class="muRecipe">def</span> to-text in:address:list:_elem<span class="muRecipe"> -> </span>result:address:array:character [ <span class="Constant">local-scope</span> <span class="Constant">load-ingredients</span> - buf:address:shared:buffer<span class="Special"> <- </span>new-buffer <span class="Constant">80</span> + buf:address:buffer<span class="Special"> <- </span>new-buffer <span class="Constant">80</span> buf<span class="Special"> <- </span>to-buffer in, buf result<span class="Special"> <- </span>buffer-to-array buf ] <span class="Comment"># variant of 'to-text' which stops printing after a few elements (and so is robust to cycles)</span> -<span class="muRecipe">def</span> to-text-line in:address:shared:list:_elem<span class="muRecipe"> -> </span>result:address:shared:array:character [ +<span class="muRecipe">def</span> to-text-line in:address:list:_elem<span class="muRecipe"> -> </span>result:address:array:character [ <span class="Constant">local-scope</span> <span class="Constant">load-ingredients</span> - buf:address:shared:buffer<span class="Special"> <- </span>new-buffer <span class="Constant">80</span> + buf:address:buffer<span class="Special"> <- </span>new-buffer <span class="Constant">80</span> buf<span class="Special"> <- </span>to-buffer in, buf, <span class="Constant">6</span> <span class="Comment"># max elements to display</span> result<span class="Special"> <- </span>buffer-to-array buf ] -<span class="muRecipe">def</span> to-buffer in:address:shared:list:_elem, buf:address:shared:buffer<span class="muRecipe"> -> </span>buf:address:shared:buffer [ +<span class="muRecipe">def</span> to-buffer in:address:list:_elem, buf:address:buffer<span class="muRecipe"> -> </span>buf:address:buffer [ <span class="Constant">local-scope</span> <span class="Constant">load-ingredients</span> <span class="Delimiter">{</span> @@ -114,7 +111,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color val:_elem<span class="Special"> <- </span>get *in, <span class="Constant">value:offset</span> buf<span class="Special"> <- </span>append buf, val <span class="Comment"># now prepare next</span> - next:address:shared:list:_elem<span class="Special"> <- </span>rest in + next:address:list:_elem<span class="Special"> <- </span>rest in nextn:number<span class="Special"> <- </span>copy next <span class="muControl">return-unless</span> next buf<span class="Special"> <- </span>append buf, <span class="Constant">[ -> ]</span> |