diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2016-09-17 15:01:51 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2016-09-17 15:01:51 -0700 |
commit | f344b250f6f062a1a1902bf69b23ebf9b565de0e (patch) | |
tree | 199bd32a9aee198d5028b1c21b83d2cf0944b2b6 /html/032array.cc.html | |
parent | 897ae8c1855f830d8819759ea327d147f28a09bf (diff) | |
download | mu-f344b250f6f062a1a1902bf69b23ebf9b565de0e.tar.gz |
3395
Diffstat (limited to 'html/032array.cc.html')
-rw-r--r-- | html/032array.cc.html | 178 |
1 files changed, 89 insertions, 89 deletions
diff --git a/html/032array.cc.html b/html/032array.cc.html index 1a733068..77cfb88c 100644 --- a/html/032array.cc.html +++ b/html/032array.cc.html @@ -44,7 +44,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="Delimiter">:(scenario create_array)</span> def main [ <span class="Comment"># create an array occupying locations 1 (for the size) and 2-4 (for the elements)</span> - <span class="Constant">1</span>:array:number:<span class="Constant">3</span><span class="Special"> <- </span>create-array + <span class="Constant">1</span>:array:num:<span class="Constant">3</span><span class="Special"> <- </span>create-array ] <span class="traceContains">+run: creating array of size 4</span> @@ -112,11 +112,11 @@ put<span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span <span class="Comment"># 'static' array, and one without a 'dynamic' array since it can contain</span> <span class="Comment"># arrays of many different sizes.</span> def main [ - <span class="Constant">1</span>:array:number:<span class="Constant">3</span><span class="Special"> <- </span>create-array - <span class="Constant">2</span>:number<span class="Special"> <- </span>copy <span class="Constant">14</span> - <span class="Constant">3</span>:number<span class="Special"> <- </span>copy <span class="Constant">15</span> - <span class="Constant">4</span>:number<span class="Special"> <- </span>copy <span class="Constant">16</span> - <span class="Constant">5</span>:array:number<span class="Special"> <- </span>copy <span class="Constant">1</span>:array:number:<span class="Constant">3</span> + <span class="Constant">1</span>:array:num:<span class="Constant">3</span><span class="Special"> <- </span>create-array + <span class="Constant">2</span>:num<span class="Special"> <- </span>copy <span class="Constant">14</span> + <span class="Constant">3</span>:num<span class="Special"> <- </span>copy <span class="Constant">15</span> + <span class="Constant">4</span>:num<span class="Special"> <- </span>copy <span class="Constant">16</span> + <span class="Constant">5</span>:array:num<span class="Special"> <- </span>copy <span class="Constant">1</span>:array:num:<span class="Constant">3</span> ] <span class="traceContains">+mem: storing 3 in location 5</span> <span class="traceContains">+mem: storing 14 in location 6</span> @@ -125,11 +125,11 @@ def main [ <span class="Delimiter">:(scenario stash_array)</span> def main [ - <span class="Constant">1</span>:array:number:<span class="Constant">3</span><span class="Special"> <- </span>create-array - <span class="Constant">2</span>:number<span class="Special"> <- </span>copy <span class="Constant">14</span> - <span class="Constant">3</span>:number<span class="Special"> <- </span>copy <span class="Constant">15</span> - <span class="Constant">4</span>:number<span class="Special"> <- </span>copy <span class="Constant">16</span> - stash [foo:]<span class="Delimiter">,</span> <span class="Constant">1</span>:array:number:<span class="Constant">3</span> + <span class="Constant">1</span>:array:num:<span class="Constant">3</span><span class="Special"> <- </span>create-array + <span class="Constant">2</span>:num<span class="Special"> <- </span>copy <span class="Constant">14</span> + <span class="Constant">3</span>:num<span class="Special"> <- </span>copy <span class="Constant">15</span> + <span class="Constant">4</span>:num<span class="Special"> <- </span>copy <span class="Constant">16</span> + stash [foo:]<span class="Delimiter">,</span> <span class="Constant">1</span>:array:num:<span class="Constant">3</span> ] <span class="traceContains">+app: foo: 3 14 15 16</span> @@ -155,14 +155,14 @@ def main [ <span class="Delimiter">:(scenario container_permits_static_array_element)</span> container foo [ - <span class="Normal">x</span>:array:number:<span class="Constant">3</span> + <span class="Normal">x</span>:array:num:<span class="Constant">3</span> ] $error: <span class="Constant">0</span> <span class="Delimiter">:(scenario container_disallows_dynamic_array_element)</span> <span class="Special">% Hide_errors = true;</span> container foo [ - <span class="Normal">x</span>:array:number + <span class="Normal">x</span>:array:num ] <span class="traceContains">+error: container 'foo' cannot determine size of element 'x'</span> @@ -176,12 +176,12 @@ container foo [ <span class="Delimiter">:(scenario merge_static_array_into_container)</span> container foo [ - <span class="Normal">x</span>:number - <span class="Normal">y</span>:array:number:<span class="Constant">3</span> + <span class="Normal">x</span>:num + <span class="Normal">y</span>:array:num:<span class="Constant">3</span> ] def main [ - <span class="Constant">1</span>:array:number:<span class="Constant">3</span><span class="Special"> <- </span>create-array - <span class="Constant">10</span>:foo<span class="Special"> <- </span>merge <span class="Constant">34</span><span class="Delimiter">,</span> <span class="Constant">1</span>:array:number:<span class="Constant">3</span> + <span class="Constant">1</span>:array:num:<span class="Constant">3</span><span class="Special"> <- </span>create-array + <span class="Constant">10</span>:foo<span class="Special"> <- </span>merge <span class="Constant">34</span><span class="Delimiter">,</span> <span class="Constant">1</span>:array:num:<span class="Constant">3</span> ] <span class="Comment"># no errors</span> @@ -207,11 +207,11 @@ def main [ <span class="Delimiter">:(scenario code_inside_container)</span> <span class="Special">% Hide_errors = true;</span> container card [ - <span class="Normal">rank</span>:number<span class="Special"> <- </span>next-ingredient + <span class="Normal">rank</span>:num<span class="Special"> <- </span>next-ingredient ] def foo [ <span class="Constant">1</span>:card<span class="Special"> <- </span>merge <span class="Constant">3</span> - <span class="Constant">2</span>:number<span class="Special"> <- </span>get <span class="Constant">1</span>:card rank:offset + <span class="Constant">2</span>:num<span class="Special"> <- </span>get <span class="Constant">1</span>:card rank:offset ] <span class="Comment"># shouldn't die</span> @@ -219,32 +219,32 @@ def foo [ <span class="Delimiter">:(scenario index)</span> def main [ - <span class="Constant">1</span>:array:number:<span class="Constant">3</span><span class="Special"> <- </span>create-array - <span class="Constant">2</span>:number<span class="Special"> <- </span>copy <span class="Constant">14</span> - <span class="Constant">3</span>:number<span class="Special"> <- </span>copy <span class="Constant">15</span> - <span class="Constant">4</span>:number<span class="Special"> <- </span>copy <span class="Constant">16</span> - <span class="Constant">5</span>:number<span class="Special"> <- </span>index <span class="Constant">1</span>:array:number:<span class="Constant">3</span><span class="Delimiter">,</span> <span class="Constant">0</span> + <span class="Constant">1</span>:array:num:<span class="Constant">3</span><span class="Special"> <- </span>create-array + <span class="Constant">2</span>:num<span class="Special"> <- </span>copy <span class="Constant">14</span> + <span class="Constant">3</span>:num<span class="Special"> <- </span>copy <span class="Constant">15</span> + <span class="Constant">4</span>:num<span class="Special"> <- </span>copy <span class="Constant">16</span> + <span class="Constant">5</span>:num<span class="Special"> <- </span>index <span class="Constant">1</span>:array:num:<span class="Constant">3</span><span class="Delimiter">,</span> <span class="Constant">0</span> ] <span class="traceContains">+mem: storing 14 in location 5</span> <span class="Delimiter">:(scenario index_compound_element)</span> def main [ <span class="Delimiter">{</span><span class="Constant">1</span>: <span class="Delimiter">(</span>array <span class="Delimiter">(</span>address number<span class="Delimiter">)</span> <span class="Constant">3</span><span class="Delimiter">)}</span><span class="Special"> <- </span>create-array - <span class="Constant">2</span>:number<span class="Special"> <- </span>copy <span class="Constant">14</span> - <span class="Constant">3</span>:number<span class="Special"> <- </span>copy <span class="Constant">15</span> - <span class="Constant">4</span>:number<span class="Special"> <- </span>copy <span class="Constant">16</span> - <span class="Constant">5</span>:address:number<span class="Special"> <- </span>index <span class="Delimiter">{</span><span class="Constant">1</span>: <span class="Delimiter">(</span>array <span class="Delimiter">(</span>address number<span class="Delimiter">)</span> <span class="Constant">3</span><span class="Delimiter">)},</span> <span class="Constant">0</span> + <span class="Constant">2</span>:num<span class="Special"> <- </span>copy <span class="Constant">14</span> + <span class="Constant">3</span>:num<span class="Special"> <- </span>copy <span class="Constant">15</span> + <span class="Constant">4</span>:num<span class="Special"> <- </span>copy <span class="Constant">16</span> + <span class="Constant">5</span>:address:num<span class="Special"> <- </span>index <span class="Delimiter">{</span><span class="Constant">1</span>: <span class="Delimiter">(</span>array <span class="Delimiter">(</span>address number<span class="Delimiter">)</span> <span class="Constant">3</span><span class="Delimiter">)},</span> <span class="Constant">0</span> ] <span class="traceContains">+mem: storing 14 in location 5</span> <span class="Delimiter">:(scenario index_direct_offset)</span> def main [ - <span class="Constant">1</span>:array:number:<span class="Constant">3</span><span class="Special"> <- </span>create-array - <span class="Constant">2</span>:number<span class="Special"> <- </span>copy <span class="Constant">14</span> - <span class="Constant">3</span>:number<span class="Special"> <- </span>copy <span class="Constant">15</span> - <span class="Constant">4</span>:number<span class="Special"> <- </span>copy <span class="Constant">16</span> - <span class="Constant">5</span>:number<span class="Special"> <- </span>copy <span class="Constant">0</span> - <span class="Constant">6</span>:number<span class="Special"> <- </span>index <span class="Constant">1</span>:array:number<span class="Delimiter">,</span> <span class="Constant">5</span>:number + <span class="Constant">1</span>:array:num:<span class="Constant">3</span><span class="Special"> <- </span>create-array + <span class="Constant">2</span>:num<span class="Special"> <- </span>copy <span class="Constant">14</span> + <span class="Constant">3</span>:num<span class="Special"> <- </span>copy <span class="Constant">15</span> + <span class="Constant">4</span>:num<span class="Special"> <- </span>copy <span class="Constant">16</span> + <span class="Constant">5</span>:num<span class="Special"> <- </span>copy <span class="Constant">0</span> + <span class="Constant">6</span>:num<span class="Special"> <- </span>index <span class="Constant">1</span>:array:num<span class="Delimiter">,</span> <span class="Constant">5</span>:num ] <span class="traceContains">+mem: storing 14 in location 6</span> @@ -313,7 +313,7 @@ put<span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span <span class="Delimiter">:(code)</span> type_tree* copy_array_element<span class="Delimiter">(</span><span class="Normal">const</span> type_tree* type<span class="Delimiter">)</span> <span class="Delimiter">{</span> assert<span class="Delimiter">(</span>type<span class="Delimiter">-></span>right<span class="Delimiter">);</span> - <span class="Comment">// hack: don't require parens for either array:number:3 array:address:number</span> + <span class="Comment">// hack: don't require parens for either array:num:3 array:address:num</span> <span class="Normal">if</span> <span class="Delimiter">(</span>!type<span class="Delimiter">-></span>right<span class="Delimiter">-></span>atom && type<span class="Delimiter">-></span>right<span class="Delimiter">-></span>right && type<span class="Delimiter">-></span>right<span class="Delimiter">-></span>right<span class="Delimiter">-></span>atom && is_integer<span class="Delimiter">(</span>type<span class="Delimiter">-></span>right<span class="Delimiter">-></span>right<span class="Delimiter">-></span>name<span class="Delimiter">))</span> <span class="Identifier">return</span> <span class="Normal">new</span> type_tree<span class="Delimiter">(</span>*type<span class="Delimiter">-></span>right<span class="Delimiter">-></span>left<span class="Delimiter">);</span> <span class="Identifier">return</span> <span class="Normal">new</span> type_tree<span class="Delimiter">(</span>*type<span class="Delimiter">-></span>right<span class="Delimiter">);</span> @@ -335,7 +335,7 @@ type_tree* copy_array_element<span class="Delimiter">(</span><span class="Normal put<span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> <span class="Constant">2</span><span class="Delimiter">,</span> <span class="Constant">14</span><span class="Delimiter">);</span> put<span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> <span class="Constant">3</span><span class="Delimiter">,</span> <span class="Constant">15</span><span class="Delimiter">);</span> put<span class="Delimiter">(</span>Memory<span class="Delimiter">,</span> <span class="Constant">4</span><span class="Delimiter">,</span> <span class="Constant">16</span><span class="Delimiter">);</span> - reagent x<span class="Delimiter">(</span><span class="Constant">"1:array:address:number"</span><span class="Delimiter">);</span> <span class="Comment">// 3 types, but not a static array</span> + reagent x<span class="Delimiter">(</span><span class="Constant">"1:array:address:num"</span><span class="Delimiter">);</span> <span class="Comment">// 3 types, but not a static array</span> populate_value<span class="Delimiter">(</span>x<span class="Delimiter">);</span> CHECK_EQ<span class="Delimiter">(</span>array_length<span class="Delimiter">(</span>x<span class="Delimiter">),</span> <span class="Constant">3</span><span class="Delimiter">);</span> <span class="Delimiter">}</span> @@ -343,27 +343,27 @@ type_tree* copy_array_element<span class="Delimiter">(</span><span class="Normal <span class="Delimiter">:(scenario index_out_of_bounds)</span> <span class="Special">% Hide_errors = true;</span> def main [ - <span class="Constant">1</span>:array:number:<span class="Constant">3</span><span class="Special"> <- </span>create-array - <span class="Constant">2</span>:number<span class="Special"> <- </span>copy <span class="Constant">14</span> - <span class="Constant">3</span>:number<span class="Special"> <- </span>copy <span class="Constant">15</span> - <span class="Constant">4</span>:number<span class="Special"> <- </span>copy <span class="Constant">16</span> - <span class="Constant">5</span>:number<span class="Special"> <- </span>copy <span class="Constant">14</span> - <span class="Constant">6</span>:number<span class="Special"> <- </span>copy <span class="Constant">15</span> - <span class="Constant">7</span>:number<span class="Special"> <- </span>copy <span class="Constant">16</span> - index <span class="Constant">1</span>:array:number:<span class="Constant">3</span><span class="Delimiter">,</span> <span class="Constant">4</span> <span class="Comment"># less than size of array in locations, but larger than its length in elements</span> + <span class="Constant">1</span>:array:num:<span class="Constant">3</span><span class="Special"> <- </span>create-array + <span class="Constant">2</span>:num<span class="Special"> <- </span>copy <span class="Constant">14</span> + <span class="Constant">3</span>:num<span class="Special"> <- </span>copy <span class="Constant">15</span> + <span class="Constant">4</span>:num<span class="Special"> <- </span>copy <span class="Constant">16</span> + <span class="Constant">5</span>:num<span class="Special"> <- </span>copy <span class="Constant">14</span> + <span class="Constant">6</span>:num<span class="Special"> <- </span>copy <span class="Constant">15</span> + <span class="Constant">7</span>:num<span class="Special"> <- </span>copy <span class="Constant">16</span> + index <span class="Constant">1</span>:array:num:<span class="Constant">3</span><span class="Delimiter">,</span> <span class="Constant">4</span> <span class="Comment"># less than size of array in locations, but larger than its length in elements</span> ] -<span class="traceContains">+error: main: invalid index 4 in 'index 1:array:number:3, 4'</span> +<span class="traceContains">+error: main: invalid index 4 in 'index 1:array:num:3, 4'</span> <span class="Delimiter">:(scenario index_out_of_bounds_2)</span> <span class="Special">% Hide_errors = true;</span> def main [ <span class="Constant">1</span>:array:point:<span class="Constant">3</span><span class="Special"> <- </span>create-array - <span class="Constant">2</span>:number<span class="Special"> <- </span>copy <span class="Constant">14</span> - <span class="Constant">3</span>:number<span class="Special"> <- </span>copy <span class="Constant">15</span> - <span class="Constant">4</span>:number<span class="Special"> <- </span>copy <span class="Constant">16</span> - <span class="Constant">5</span>:number<span class="Special"> <- </span>copy <span class="Constant">14</span> - <span class="Constant">6</span>:number<span class="Special"> <- </span>copy <span class="Constant">15</span> - <span class="Constant">7</span>:number<span class="Special"> <- </span>copy <span class="Constant">16</span> + <span class="Constant">2</span>:num<span class="Special"> <- </span>copy <span class="Constant">14</span> + <span class="Constant">3</span>:num<span class="Special"> <- </span>copy <span class="Constant">15</span> + <span class="Constant">4</span>:num<span class="Special"> <- </span>copy <span class="Constant">16</span> + <span class="Constant">5</span>:num<span class="Special"> <- </span>copy <span class="Constant">14</span> + <span class="Constant">6</span>:num<span class="Special"> <- </span>copy <span class="Constant">15</span> + <span class="Constant">7</span>:num<span class="Special"> <- </span>copy <span class="Constant">16</span> index <span class="Constant">1</span>:array:point<span class="Delimiter">,</span> -<span class="Constant">1</span> ] <span class="traceContains">+error: main: invalid index -1 in 'index 1:array:point, -1'</span> @@ -372,25 +372,25 @@ def main [ <span class="Special">% Hide_errors = true;</span> def main [ <span class="Constant">1</span>:array:point:<span class="Constant">3</span><span class="Special"> <- </span>create-array - <span class="Constant">2</span>:number<span class="Special"> <- </span>copy <span class="Constant">14</span> - <span class="Constant">3</span>:number<span class="Special"> <- </span>copy <span class="Constant">15</span> - <span class="Constant">4</span>:number<span class="Special"> <- </span>copy <span class="Constant">16</span> - <span class="Constant">5</span>:number<span class="Special"> <- </span>copy <span class="Constant">14</span> - <span class="Constant">6</span>:number<span class="Special"> <- </span>copy <span class="Constant">15</span> - <span class="Constant">7</span>:number<span class="Special"> <- </span>copy <span class="Constant">16</span> - <span class="Constant">9</span>:number<span class="Special"> <- </span>index <span class="Constant">1</span>:array:point<span class="Delimiter">,</span> <span class="Constant">0</span> + <span class="Constant">2</span>:num<span class="Special"> <- </span>copy <span class="Constant">14</span> + <span class="Constant">3</span>:num<span class="Special"> <- </span>copy <span class="Constant">15</span> + <span class="Constant">4</span>:num<span class="Special"> <- </span>copy <span class="Constant">16</span> + <span class="Constant">5</span>:num<span class="Special"> <- </span>copy <span class="Constant">14</span> + <span class="Constant">6</span>:num<span class="Special"> <- </span>copy <span class="Constant">15</span> + <span class="Constant">7</span>:num<span class="Special"> <- </span>copy <span class="Constant">16</span> + <span class="Constant">9</span>:num<span class="Special"> <- </span>index <span class="Constant">1</span>:array:point<span class="Delimiter">,</span> <span class="Constant">0</span> ] -<span class="traceContains">+error: main: 'index' on '1:array:point' can't be saved in '9:number'; type should be 'point'</span> +<span class="traceContains">+error: main: 'index' on '1:array:point' can't be saved in '9:num'; type should be 'point'</span> <span class="Comment">//: we might want to call 'index' without saving the results, say in a sandbox</span> <span class="Delimiter">:(scenario index_without_product)</span> def main [ - <span class="Constant">1</span>:array:number:<span class="Constant">3</span><span class="Special"> <- </span>create-array - <span class="Constant">2</span>:number<span class="Special"> <- </span>copy <span class="Constant">14</span> - <span class="Constant">3</span>:number<span class="Special"> <- </span>copy <span class="Constant">15</span> - <span class="Constant">4</span>:number<span class="Special"> <- </span>copy <span class="Constant">16</span> - index <span class="Constant">1</span>:array:number:<span class="Constant">3</span><span class="Delimiter">,</span> <span class="Constant">0</span> + <span class="Constant">1</span>:array:num:<span class="Constant">3</span><span class="Special"> <- </span>create-array + <span class="Constant">2</span>:num<span class="Special"> <- </span>copy <span class="Constant">14</span> + <span class="Constant">3</span>:num<span class="Special"> <- </span>copy <span class="Constant">15</span> + <span class="Constant">4</span>:num<span class="Special"> <- </span>copy <span class="Constant">16</span> + index <span class="Constant">1</span>:array:num:<span class="Constant">3</span><span class="Delimiter">,</span> <span class="Constant">0</span> ] <span class="Comment"># just don't die</span> @@ -398,11 +398,11 @@ def main [ <span class="Delimiter">:(scenario put_index)</span> def main [ - <span class="Constant">1</span>:array:number:<span class="Constant">3</span><span class="Special"> <- </span>create-array - <span class="Constant">2</span>:number<span class="Special"> <- </span>copy <span class="Constant">14</span> - <span class="Constant">3</span>:number<span class="Special"> <- </span>copy <span class="Constant">15</span> - <span class="Constant">4</span>:number<span class="Special"> <- </span>copy <span class="Constant">16</span> - <span class="Constant">1</span>:array:number<span class="Special"> <- </span>put-index <span class="Constant">1</span>:array:number<span class="Delimiter">,</span> <span class="Constant">1</span><span class="Delimiter">,</span> <span class="Constant">34</span> + <span class="Constant">1</span>:array:num:<span class="Constant">3</span><span class="Special"> <- </span>create-array + <span class="Constant">2</span>:num<span class="Special"> <- </span>copy <span class="Constant">14</span> + <span class="Constant">3</span>:num<span class="Special"> <- </span>copy <span class="Constant">15</span> + <span class="Constant">4</span>:num<span class="Special"> <- </span>copy <span class="Constant">16</span> + <span class="Constant">1</span>:array:num<span class="Special"> <- </span>put-index <span class="Constant">1</span>:array:num<span class="Delimiter">,</span> <span class="Constant">1</span><span class="Delimiter">,</span> <span class="Constant">34</span> ] <span class="traceContains">+mem: storing 34 in location 3</span> @@ -480,12 +480,12 @@ put<span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span <span class="Special">% Hide_errors = true;</span> def main [ <span class="Constant">1</span>:array:point:<span class="Constant">3</span><span class="Special"> <- </span>create-array - <span class="Constant">2</span>:number<span class="Special"> <- </span>copy <span class="Constant">14</span> - <span class="Constant">3</span>:number<span class="Special"> <- </span>copy <span class="Constant">15</span> - <span class="Constant">4</span>:number<span class="Special"> <- </span>copy <span class="Constant">16</span> - <span class="Constant">5</span>:number<span class="Special"> <- </span>copy <span class="Constant">14</span> - <span class="Constant">6</span>:number<span class="Special"> <- </span>copy <span class="Constant">15</span> - <span class="Constant">7</span>:number<span class="Special"> <- </span>copy <span class="Constant">16</span> + <span class="Constant">2</span>:num<span class="Special"> <- </span>copy <span class="Constant">14</span> + <span class="Constant">3</span>:num<span class="Special"> <- </span>copy <span class="Constant">15</span> + <span class="Constant">4</span>:num<span class="Special"> <- </span>copy <span class="Constant">16</span> + <span class="Constant">5</span>:num<span class="Special"> <- </span>copy <span class="Constant">14</span> + <span class="Constant">6</span>:num<span class="Special"> <- </span>copy <span class="Constant">15</span> + <span class="Constant">7</span>:num<span class="Special"> <- </span>copy <span class="Constant">16</span> <span class="Constant">8</span>:point<span class="Special"> <- </span>merge <span class="Constant">34</span><span class="Delimiter">,</span> <span class="Constant">35</span> <span class="Constant">1</span>:array:point<span class="Special"> <- </span>put-index <span class="Constant">1</span>:array:point<span class="Delimiter">,</span> <span class="Constant">4</span><span class="Delimiter">,</span> <span class="Constant">8</span>:point <span class="Comment"># '4' is less than size of array in locations, but larger than its length in elements</span> ] @@ -495,12 +495,12 @@ def main [ <span class="Special">% Hide_errors = true;</span> def main [ <span class="Constant">1</span>:array:point:<span class="Constant">3</span><span class="Special"> <- </span>create-array - <span class="Constant">2</span>:number<span class="Special"> <- </span>copy <span class="Constant">14</span> - <span class="Constant">3</span>:number<span class="Special"> <- </span>copy <span class="Constant">15</span> - <span class="Constant">4</span>:number<span class="Special"> <- </span>copy <span class="Constant">16</span> - <span class="Constant">5</span>:number<span class="Special"> <- </span>copy <span class="Constant">14</span> - <span class="Constant">6</span>:number<span class="Special"> <- </span>copy <span class="Constant">15</span> - <span class="Constant">7</span>:number<span class="Special"> <- </span>copy <span class="Constant">16</span> + <span class="Constant">2</span>:num<span class="Special"> <- </span>copy <span class="Constant">14</span> + <span class="Constant">3</span>:num<span class="Special"> <- </span>copy <span class="Constant">15</span> + <span class="Constant">4</span>:num<span class="Special"> <- </span>copy <span class="Constant">16</span> + <span class="Constant">5</span>:num<span class="Special"> <- </span>copy <span class="Constant">14</span> + <span class="Constant">6</span>:num<span class="Special"> <- </span>copy <span class="Constant">15</span> + <span class="Constant">7</span>:num<span class="Special"> <- </span>copy <span class="Constant">16</span> <span class="Constant">8</span>:point<span class="Special"> <- </span>merge <span class="Constant">34</span><span class="Delimiter">,</span> <span class="Constant">35</span> <span class="Constant">1</span>:array:point<span class="Special"> <- </span>put-index <span class="Constant">1</span>:array:point<span class="Delimiter">,</span> -<span class="Constant">1</span><span class="Delimiter">,</span> <span class="Constant">8</span>:point ] @@ -511,20 +511,20 @@ def main [ def main [ local-scope load-ingredients - <span class="Constant">1</span>:array:number:<span class="Constant">3</span><span class="Special"> <- </span>create-array - <span class="Constant">4</span>:array:number:<span class="Constant">3</span><span class="Special"> <- </span>put-index <span class="Constant">1</span>:array:number:<span class="Constant">3</span><span class="Delimiter">,</span> <span class="Constant">0</span><span class="Delimiter">,</span> <span class="Constant">34</span> + <span class="Constant">1</span>:array:num:<span class="Constant">3</span><span class="Special"> <- </span>create-array + <span class="Constant">4</span>:array:num:<span class="Constant">3</span><span class="Special"> <- </span>put-index <span class="Constant">1</span>:array:num:<span class="Constant">3</span><span class="Delimiter">,</span> <span class="Constant">0</span><span class="Delimiter">,</span> <span class="Constant">34</span> ] -<span class="traceContains">+error: main: product of 'put-index' must be first ingredient '1:array:number:3', but got '4:array:number:3'</span> +<span class="traceContains">+error: main: product of 'put-index' must be first ingredient '1:array:num:3', but got '4:array:num:3'</span> <span class="SalientComment">//:: compute the length of an array</span> <span class="Delimiter">:(scenario array_length)</span> def main [ - <span class="Constant">1</span>:array:number:<span class="Constant">3</span><span class="Special"> <- </span>create-array - <span class="Constant">2</span>:number<span class="Special"> <- </span>copy <span class="Constant">14</span> - <span class="Constant">3</span>:number<span class="Special"> <- </span>copy <span class="Constant">15</span> - <span class="Constant">4</span>:number<span class="Special"> <- </span>copy <span class="Constant">16</span> - <span class="Constant">5</span>:number<span class="Special"> <- </span>length <span class="Constant">1</span>:array:number:<span class="Constant">3</span> + <span class="Constant">1</span>:array:num:<span class="Constant">3</span><span class="Special"> <- </span>create-array + <span class="Constant">2</span>:num<span class="Special"> <- </span>copy <span class="Constant">14</span> + <span class="Constant">3</span>:num<span class="Special"> <- </span>copy <span class="Constant">15</span> + <span class="Constant">4</span>:num<span class="Special"> <- </span>copy <span class="Constant">16</span> + <span class="Constant">5</span>:num<span class="Special"> <- </span>length <span class="Constant">1</span>:array:num:<span class="Constant">3</span> ] <span class="traceContains">+mem: storing 3 in location 5</span> |