diff options
Diffstat (limited to 'html/074list.mu.html')
-rw-r--r-- | html/074list.mu.html | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/html/074list.mu.html b/html/074list.mu.html index bb619f3e..be4c153f 100644 --- a/html/074list.mu.html +++ b/html/074list.mu.html @@ -42,12 +42,11 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color next:address:list:_elem ] -<span class="muRecipe">def</span> push x:_elem, in:address:list:_elem<span class="muRecipe"> -> </span>in:address:list:_elem [ +<span class="muRecipe">def</span> push x:_elem, in:address:list:_elem<span class="muRecipe"> -> </span>result:address:list:_elem [ <span class="Constant">local-scope</span> <span class="Constant">load-ingredients</span> - 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>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:list:_elem<span class="muRecipe"> -> </span>result:_elem [ @@ -82,6 +81,15 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] ] +<span class="muRecipe">def</span> length l:address:list:_elem<span class="muRecipe"> -> </span>result:number [ + <span class="Constant">local-scope</span> + <span class="Constant">load-ingredients</span> + <span class="muControl">return-unless</span> l, <span class="Constant">0</span> + rest:address:list:_elem<span class="Special"> <- </span>rest l + length-of-rest:number<span class="Special"> <- </span>length rest + result<span class="Special"> <- </span>add length-of-rest, <span class="Constant">1</span> +] + <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> |