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/073array.mu.html | |
parent | 224972ee9871fcb06ee285fa5f3d9528c034d414 (diff) | |
download | mu-32b8fac2799ac7cec613e84a3eb9c009141b6a3a.tar.gz |
2866
Diffstat (limited to 'html/073array.mu.html')
-rw-r--r-- | html/073array.mu.html | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/html/073array.mu.html b/html/073array.mu.html index 8cafa8d5..433e2044 100644 --- a/html/073array.mu.html +++ b/html/073array.mu.html @@ -33,8 +33,8 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <pre id='vimCodeElement'> <span class="muScenario">scenario</span> array-from-args [ run [ - <span class="Constant">1</span>:address:shared:array:character<span class="Special"> <- </span>new-array <span class="Constant">0</span>, <span class="Constant">1</span>, <span class="Constant">2</span> - <span class="Constant">2</span>:array:character<span class="Special"> <- </span>copy *<span class="Constant">1</span>:address:shared:array:character + <span class="Constant">1</span>:address:array:character<span class="Special"> <- </span>new-array <span class="Constant">0</span>, <span class="Constant">1</span>, <span class="Constant">2</span> + <span class="Constant">2</span>:array:character<span class="Special"> <- </span>copy *<span class="Constant">1</span>:address:array:character ] memory-should-contain [ <span class="Constant">2</span><span class="Special"> <- </span><span class="Constant">3</span> <span class="Comment"># array length</span> @@ -45,7 +45,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] <span class="Comment"># create an array out of a list of scalar args</span> -<span class="muRecipe">def</span> new-array<span class="muRecipe"> -> </span>result:address:shared:array:character [ +<span class="muRecipe">def</span> new-array<span class="muRecipe"> -> </span>result:address:array:character [ <span class="Constant">local-scope</span> capacity:number<span class="Special"> <- </span>copy <span class="Constant">0</span> <span class="Delimiter">{</span> @@ -56,7 +56,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="muControl">loop</span> <span class="Delimiter">}</span> result<span class="Special"> <- </span>new <span class="Constant">character:type</span>, capacity - rewind-ingredients + <span class="Constant">rewind-ingredients</span> i:number<span class="Special"> <- </span>copy <span class="Constant">0</span> <span class="Delimiter">{</span> <span class="Comment"># while read curr-value</span> @@ -64,8 +64,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="muControl">break-if</span> done? curr-value:character, exists?:boolean<span class="Special"> <- </span><span class="Constant">next-ingredient</span> assert exists?, <span class="Constant">[error in rewinding ingredients to new-array]</span> - tmp:address:character<span class="Special"> <- </span>index-address *result, i - *tmp<span class="Special"> <- </span>copy curr-value + *result<span class="Special"> <- </span>put-index *result, i, curr-value i<span class="Special"> <- </span>add i, <span class="Constant">1</span> <span class="muControl">loop</span> <span class="Delimiter">}</span> |