diff options
Diffstat (limited to 'html/063array.mu.html')
-rw-r--r-- | html/063array.mu.html | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/html/063array.mu.html b/html/063array.mu.html index 23337615..55a44ac1 100644 --- a/html/063array.mu.html +++ b/html/063array.mu.html @@ -58,7 +58,7 @@ if ('onhashchange' in window) { <span id="L1" class="LineNr"> 1 </span><span class="muScenario">scenario</span> array-from-args [ <span id="L2" class="LineNr"> 2 </span> run [ <span id="L3" class="LineNr"> 3 </span> <span class="Constant">local-scope</span> -<span id="L4" class="LineNr"> 4 </span> x:&:@:num <span class="Special"><-</span> new-array<span class="Constant"> 0</span>,<span class="Constant"> 1</span>,<span class="Constant"> 2</span> +<span id="L4" class="LineNr"> 4 </span> x:&:@:num <span class="Special"><-</span> <a href='063array.mu.html#L16'>new-array</a><span class="Constant"> 0</span>,<span class="Constant"> 1</span>,<span class="Constant"> 2</span> <span id="L5" class="LineNr"> 5 </span> 10:@:num/<span class="Special">raw</span> <span class="Special"><-</span> copy *x <span id="L6" class="LineNr"> 6 </span> ] <span id="L7" class="LineNr"> 7 </span> memory-should-contain [ @@ -70,22 +70,22 @@ if ('onhashchange' in window) { <span id="L13" class="LineNr"> 13 </span>] <span id="L14" class="LineNr"> 14 </span> <span id="L15" class="LineNr"> 15 </span><span class="Comment"># create an array out of a list of args</span> -<span id="L16" class="LineNr"> 16 </span><span class="muRecipe">def</span> new-array<span class="muRecipe"> -> </span>result:&:@:_elem [ +<span id="L16" class="LineNr"> 16 </span><span class="muRecipe">def</span> <a href='063array.mu.html#L16'>new-array</a><span class="muRecipe"> -> </span>result:&:@:_elem [ <span id="L17" class="LineNr"> 17 </span> <span class="Constant">local-scope</span> -<span id="L18" class="LineNr"> 18 </span> capacity:num <span class="Special"><-</span> copy<span class="Constant"> 0</span> +<span id="L18" class="LineNr"> 18 </span> <a href='075channel.mu.html#L379'>capacity</a>:num <span class="Special"><-</span> copy<span class="Constant"> 0</span> <span id="L19" class="LineNr"> 19 </span> <span class="Delimiter">{</span> <span id="L20" class="LineNr"> 20 </span> <span class="Comment"># while read curr-value</span> <span id="L21" class="LineNr"> 21 </span> curr-value:_elem, exists?:bool <span class="Special"><-</span> <span class="Constant">next-ingredient</span> <span id="L22" class="LineNr"> 22 </span> <span class="muControl">break-unless</span> exists? -<span id="L23" class="LineNr"> 23 </span> capacity <span class="Special"><-</span> add capacity,<span class="Constant"> 1</span> +<span id="L23" class="LineNr"> 23 </span> <a href='075channel.mu.html#L379'>capacity</a> <span class="Special"><-</span> add <a href='075channel.mu.html#L379'>capacity</a>,<span class="Constant"> 1</span> <span id="L24" class="LineNr"> 24 </span> <span class="muControl">loop</span> <span id="L25" class="LineNr"> 25 </span> <span class="Delimiter">}</span> -<span id="L26" class="LineNr"> 26 </span> result <span class="Special"><-</span> new <span class="Constant">_elem:type</span>, capacity +<span id="L26" class="LineNr"> 26 </span> result <span class="Special"><-</span> new <span class="Constant">_elem:type</span>, <a href='075channel.mu.html#L379'>capacity</a> <span id="L27" class="LineNr"> 27 </span> <span class="Constant">rewind-ingredients</span> <span id="L28" class="LineNr"> 28 </span> i:num <span class="Special"><-</span> copy<span class="Constant"> 0</span> <span id="L29" class="LineNr"> 29 </span> <span class="Delimiter">{</span> <span id="L30" class="LineNr"> 30 </span> <span class="Comment"># while read curr-value</span> -<span id="L31" class="LineNr"> 31 </span> done?:bool <span class="Special"><-</span> greater-or-equal i, capacity +<span id="L31" class="LineNr"> 31 </span> done?:bool <span class="Special"><-</span> greater-or-equal i, <a href='075channel.mu.html#L379'>capacity</a> <span id="L32" class="LineNr"> 32 </span> <span class="muControl">break-if</span> done? <span id="L33" class="LineNr"> 33 </span> curr-value:_elem, exists?:bool <span class="Special"><-</span> <span class="Constant">next-ingredient</span> <span id="L34" class="LineNr"> 34 </span> assert exists?, <span class="Constant">[error in rewinding ingredients to new-array]</span> @@ -98,7 +98,7 @@ if ('onhashchange' in window) { <span id="L41" class="LineNr"> 41 </span> <span id="L42" class="LineNr"> 42 </span><span class="Comment"># fill an existing array with a set of numbers</span> <span id="L43" class="LineNr"> 43 </span><span class="Comment"># (contributed by Caleb Couch)</span> -<span id="L44" class="LineNr"> 44 </span><span class="muRecipe">def</span> fill array:&:@:num<span class="muRecipe"> -> </span>array:&:@:num [ +<span id="L44" class="LineNr"> 44 </span><span class="muRecipe">def</span> <a href='063array.mu.html#L44'>fill</a> array:&:@:num<span class="muRecipe"> -> </span>array:&:@:num [ <span id="L45" class="LineNr"> 45 </span> <span class="Constant">local-scope</span> <span id="L46" class="LineNr"> 46 </span> <span class="Constant">load-ingredients</span> <span id="L47" class="LineNr"> 47 </span> loopn:num <span class="Special"><-</span> copy<span class="Constant"> 0</span> @@ -118,7 +118,7 @@ if ('onhashchange' in window) { <span id="L61" class="LineNr"> 61 </span> <span class="Constant">local-scope</span> <span id="L62" class="LineNr"> 62 </span> array:&:@:num <span class="Special"><-</span> new <span class="Constant">number:type</span>,<span class="Constant"> 3</span> <span id="L63" class="LineNr"> 63 </span> run [ -<span id="L64" class="LineNr"> 64 </span> array <span class="Special"><-</span> fill array,<span class="Constant"> 1 2 3</span> +<span id="L64" class="LineNr"> 64 </span> array <span class="Special"><-</span> <a href='063array.mu.html#L44'>fill</a> array,<span class="Constant"> 1 2 3</span> <span id="L65" class="LineNr"> 65 </span> 10:@:num/<span class="Special">raw</span> <span class="Special"><-</span> copy *array <span id="L66" class="LineNr"> 66 </span> ] <span id="L67" class="LineNr"> 67 </span> memory-should-contain [ @@ -134,7 +134,7 @@ if ('onhashchange' in window) { <span id="L77" class="LineNr"> 77 </span> array:&:@:num <span class="Special"><-</span> new <span class="Constant">number:type</span>,<span class="Constant"> 3</span> <span id="L78" class="LineNr"> 78 </span> *array <span class="Special"><-</span> put-index *array,<span class="Constant"> 0</span>,<span class="Constant"> 4</span> <span id="L79" class="LineNr"> 79 </span> run [ -<span id="L80" class="LineNr"> 80 </span> array <span class="Special"><-</span> fill array,<span class="Constant"> 1 2 3</span> +<span id="L80" class="LineNr"> 80 </span> array <span class="Special"><-</span> <a href='063array.mu.html#L44'>fill</a> array,<span class="Constant"> 1 2 3</span> <span id="L81" class="LineNr"> 81 </span> 10:@:num/<span class="Special">raw</span> <span class="Special"><-</span> copy *array <span id="L82" class="LineNr"> 82 </span> ] <span id="L83" class="LineNr"> 83 </span> memory-should-contain [ @@ -149,7 +149,7 @@ if ('onhashchange' in window) { <span id="L92" class="LineNr"> 92 </span> <span class="Constant">local-scope</span> <span id="L93" class="LineNr"> 93 </span> array:&:@:num <span class="Special"><-</span> new <span class="Constant">number:type</span>,<span class="Constant"> 3</span> <span id="L94" class="LineNr"> 94 </span> run [ -<span id="L95" class="LineNr"> 95 </span> array <span class="Special"><-</span> fill array +<span id="L95" class="LineNr"> 95 </span> array <span class="Special"><-</span> <a href='063array.mu.html#L44'>fill</a> array <span id="L96" class="LineNr"> 96 </span> 10:@:num/<span class="Special">raw</span> <span class="Special"><-</span> copy *array <span id="L97" class="LineNr"> 97 </span> ] <span id="L98" class="LineNr"> 98 </span> memory-should-contain [ @@ -162,7 +162,7 @@ if ('onhashchange' in window) { <span id="L105" class="LineNr">105 </span> <span id="L106" class="LineNr">106 </span><span class="Comment"># swap two elements of an array</span> <span id="L107" class="LineNr">107 </span><span class="Comment"># (contributed by Caleb Couch)</span> -<span id="L108" class="LineNr">108 </span><span class="muRecipe">def</span> swap array:&:@:num, index1:num, index2:num<span class="muRecipe"> -> </span>array:&:@:num [ +<span id="L108" class="LineNr">108 </span><span class="muRecipe">def</span> <a href='063array.mu.html#L108'>swap</a> array:&:@:num, index1:num, index2:num<span class="muRecipe"> -> </span>array:&:@:num [ <span id="L109" class="LineNr">109 </span> <span class="Constant">local-scope</span> <span id="L110" class="LineNr">110 </span> <span class="Constant">load-ingredients</span> <span id="L111" class="LineNr">111 </span> object1:num <span class="Special"><-</span> index *array, index1 @@ -174,9 +174,9 @@ if ('onhashchange' in window) { <span id="L117" class="LineNr">117 </span><span class="muScenario">scenario</span> swap-works [ <span id="L118" class="LineNr">118 </span> <span class="Constant">local-scope</span> <span id="L119" class="LineNr">119 </span> array:&:@:num <span class="Special"><-</span> new <span class="Constant">number:type</span>,<span class="Constant"> 4</span> -<span id="L120" class="LineNr">120 </span> array <span class="Special"><-</span> fill array,<span class="Constant"> 4 3 2 1</span> +<span id="L120" class="LineNr">120 </span> array <span class="Special"><-</span> <a href='063array.mu.html#L44'>fill</a> array,<span class="Constant"> 4 3 2 1</span> <span id="L121" class="LineNr">121 </span> run [ -<span id="L122" class="LineNr">122 </span> array <span class="Special"><-</span> swap array,<span class="Constant"> 0</span>,<span class="Constant"> 2</span> +<span id="L122" class="LineNr">122 </span> array <span class="Special"><-</span> <a href='063array.mu.html#L108'>swap</a> array,<span class="Constant"> 0</span>,<span class="Constant"> 2</span> <span id="L123" class="LineNr">123 </span> 10:num/<span class="Special">raw</span> <span class="Special"><-</span> index *array,<span class="Constant"> 0</span> <span id="L124" class="LineNr">124 </span> 11:num/<span class="Special">raw</span> <span class="Special"><-</span> index *array,<span class="Constant"> 2</span> <span id="L125" class="LineNr">125 </span> ] @@ -197,7 +197,7 @@ if ('onhashchange' in window) { <span id="L140" class="LineNr">140 </span> <span class="Delimiter">{</span> <span id="L141" class="LineNr">141 </span> done?:bool <span class="Special"><-</span> greater-or-equal start, end <span id="L142" class="LineNr">142 </span> <span class="muControl">break-if</span> done? -<span id="L143" class="LineNr">143 </span> array <span class="Special"><-</span> swap array, start, end +<span id="L143" class="LineNr">143 </span> array <span class="Special"><-</span> <a href='063array.mu.html#L108'>swap</a> array, start, end <span id="L144" class="LineNr">144 </span> start <span class="Special"><-</span> add start,<span class="Constant"> 1</span> <span id="L145" class="LineNr">145 </span> end <span class="Special"><-</span> subtract end,<span class="Constant"> 1</span> <span id="L146" class="LineNr">146 </span> <span class="muControl">loop</span> @@ -207,7 +207,7 @@ if ('onhashchange' in window) { <span id="L150" class="LineNr">150 </span><span class="muScenario">scenario</span> reverse-array-odd-length [ <span id="L151" class="LineNr">151 </span> <span class="Constant">local-scope</span> <span id="L152" class="LineNr">152 </span> array:&:@:num <span class="Special"><-</span> new <span class="Constant">number:type</span>,<span class="Constant"> 3</span> -<span id="L153" class="LineNr">153 </span> array <span class="Special"><-</span> fill array,<span class="Constant"> 3 2 1</span> +<span id="L153" class="LineNr">153 </span> array <span class="Special"><-</span> <a href='063array.mu.html#L44'>fill</a> array,<span class="Constant"> 3 2 1</span> <span id="L154" class="LineNr">154 </span> run [ <span id="L155" class="LineNr">155 </span> array <span class="Special"><-</span> reverse array <span id="L156" class="LineNr">156 </span> 10:@:num/<span class="Special">raw</span> <span class="Special"><-</span> copy *array @@ -223,7 +223,7 @@ if ('onhashchange' in window) { <span id="L166" class="LineNr">166 </span><span class="muScenario">scenario</span> reverse-array-even-length [ <span id="L167" class="LineNr">167 </span> <span class="Constant">local-scope</span> <span id="L168" class="LineNr">168 </span> array:&:@:num <span class="Special"><-</span> new <span class="Constant">number:type</span>,<span class="Constant"> 4</span> -<span id="L169" class="LineNr">169 </span> array <span class="Special"><-</span> fill array,<span class="Constant"> 4 3 2 1</span> +<span id="L169" class="LineNr">169 </span> array <span class="Special"><-</span> <a href='063array.mu.html#L44'>fill</a> array,<span class="Constant"> 4 3 2 1</span> <span id="L170" class="LineNr">170 </span> run [ <span id="L171" class="LineNr">171 </span> array <span class="Special"><-</span> reverse array <span id="L172" class="LineNr">172 </span> 10:@:num/<span class="Special">raw</span> <span class="Special"><-</span> copy *array |