diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2016-10-23 19:45:36 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2016-10-23 19:56:28 -0700 |
commit | f918675c8b11adb80a83000a3a984e4ff3bdcf1b (patch) | |
tree | 2472316e3bf536e0bad76751c5f3504d029b8215 /html/070table.mu.html | |
parent | af7349d50c40e0604c9bb1e9a50aa1c3c0d407d8 (diff) | |
download | mu-f918675c8b11adb80a83000a3a984e4ff3bdcf1b.tar.gz |
3569
Update syntax highlighting to not color numeric locations like literals.
Diffstat (limited to 'html/070table.mu.html')
-rw-r--r-- | html/070table.mu.html | 68 |
1 files changed, 34 insertions, 34 deletions
diff --git a/html/070table.mu.html b/html/070table.mu.html index b144969e..91999624 100644 --- a/html/070table.mu.html +++ b/html/070table.mu.html @@ -37,26 +37,26 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="muScenario">scenario</span> table-read-write [ <span class="Constant">local-scope</span> - tab:&:table:num:num<span class="Special"> <- </span>new-table <span class="Constant">30</span> + tab:&:table:num:num <span class="Special"><-</span> new-table<span class="Constant"> 30</span> run [ - put-index tab, <span class="Constant">12</span>, <span class="Constant">34</span> - <span class="Constant">1</span>:num/<span class="Special">raw <- </span>index tab, <span class="Constant">12</span> + put-index tab,<span class="Constant"> 12</span>,<span class="Constant"> 34</span> + 1:num/<span class="Special">raw</span> <span class="Special"><-</span> index tab,<span class="Constant"> 12</span> ] memory-should-contain [ - <span class="Constant">1</span><span class="Special"> <- </span><span class="Constant">34</span> + <span class="Constant"> 1</span> <span class="Special"><-</span><span class="Constant"> 34</span> ] ] <span class="muScenario">scenario</span> table-read-write-non-integer [ <span class="Constant">local-scope</span> - key:text<span class="Special"> <- </span>new <span class="Constant">[abc def]</span> - <span class="Delimiter">{</span>tab: (address table text number)<span class="Delimiter">}</span><span class="Special"> <- </span>new-table <span class="Constant">30</span> + key:text <span class="Special"><-</span> new <span class="Constant">[abc def]</span> + <span class="Delimiter">{</span>tab: (address table text number)<span class="Delimiter">}</span> <span class="Special"><-</span> new-table<span class="Constant"> 30</span> run [ - put-index tab, key, <span class="Constant">34</span> - <span class="Constant">1</span>:num/<span class="Special">raw <- </span>index tab, key + put-index tab, key,<span class="Constant"> 34</span> + 1:num/<span class="Special">raw</span> <span class="Special"><-</span> index tab, key ] memory-should-contain [ - <span class="Constant">1</span><span class="Special"> <- </span><span class="Constant">34</span> + <span class="Constant"> 1</span> <span class="Special"><-</span><span class="Constant"> 34</span> ] ] @@ -75,49 +75,49 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <span class="muRecipe">def</span> new-table capacity:num<span class="muRecipe"> -> </span>result:&:table:_key:_value [ <span class="Constant">local-scope</span> <span class="Constant">load-ingredients</span> - result<span class="Special"> <- </span>new <span class="Delimiter">{</span>(table _key _value): type<span class="Delimiter">}</span> - data:&:@:table_row:_key:_value<span class="Special"> <- </span>new <span class="Delimiter">{</span>(table_row _key _value): type<span class="Delimiter">}</span>, capacity - *result<span class="Special"> <- </span>merge <span class="Constant">0/length</span>, capacity, data + result <span class="Special"><-</span> new <span class="Delimiter">{</span>(table _key _value): type<span class="Delimiter">}</span> + data:&:@:table_row:_key:_value <span class="Special"><-</span> new <span class="Delimiter">{</span>(table_row _key _value): type<span class="Delimiter">}</span>, capacity + *result <span class="Special"><-</span> merge <span class="Constant">0/length</span>, capacity, data ] <span class="muRecipe">def</span> put-index table:&:table:_key:_value, key:_key, value:_value<span class="muRecipe"> -> </span>table:&:table:_key:_value [ <span class="Constant">local-scope</span> <span class="Constant">load-ingredients</span> - hash:num<span class="Special"> <- </span>hash key - hash<span class="Special"> <- </span>abs hash - capacity:num<span class="Special"> <- </span>get *table, <span class="Constant">capacity:offset</span> - _, hash<span class="Special"> <- </span>divide-with-remainder hash, capacity - hash<span class="Special"> <- </span>abs hash <span class="Comment"># in case hash overflows into a negative integer</span> - table-data:&:@:table_row:_key:_value<span class="Special"> <- </span>get *table, <span class="Constant">data:offset</span> - x:table_row:_key:_value<span class="Special"> <- </span>index *table-data, hash - occupied?:bool<span class="Special"> <- </span>get x, <span class="Constant">occupied?:offset</span> - not-occupied?:bool<span class="Special"> <- </span>not occupied?:bool + hash:num <span class="Special"><-</span> hash key + hash <span class="Special"><-</span> abs hash + capacity:num <span class="Special"><-</span> get *table, <span class="Constant">capacity:offset</span> + _, hash <span class="Special"><-</span> divide-with-remainder hash, capacity + hash <span class="Special"><-</span> abs hash <span class="Comment"># in case hash overflows into a negative integer</span> + table-data:&:@:table_row:_key:_value <span class="Special"><-</span> get *table, <span class="Constant">data:offset</span> + x:table_row:_key:_value <span class="Special"><-</span> index *table-data, hash + occupied?:bool <span class="Special"><-</span> get x, <span class="Constant">occupied?:offset</span> + not-occupied?:bool <span class="Special"><-</span> not occupied?:bool assert not-occupied?, <span class="Constant">[can't handle collisions yet]</span> - new-row:table_row:_key:_value<span class="Special"> <- </span>merge <span class="Constant">1/true</span>, key, value - *table-data<span class="Special"> <- </span>put-index *table-data, hash, new-row + new-row:table_row:_key:_value <span class="Special"><-</span> merge <span class="Constant">1/true</span>, key, value + *table-data <span class="Special"><-</span> put-index *table-data, hash, new-row ] <span class="muRecipe">def</span> abs n:num<span class="muRecipe"> -> </span>result:num [ <span class="Constant">local-scope</span> <span class="Constant">load-ingredients</span> - positive?:bool<span class="Special"> <- </span>greater-or-equal n, <span class="Constant">0</span> + positive?:bool <span class="Special"><-</span> greater-or-equal n,<span class="Constant"> 0</span> <span class="muControl">return-if</span> positive?, n - result<span class="Special"> <- </span>multiply n, <span class="Constant">-1</span> + result <span class="Special"><-</span> multiply n,<span class="Constant"> -1</span> ] <span class="muRecipe">def</span> index table:&:table:_key:_value, key:_key<span class="muRecipe"> -> </span>result:_value [ <span class="Constant">local-scope</span> <span class="Constant">load-ingredients</span> - hash:num<span class="Special"> <- </span>hash key - hash<span class="Special"> <- </span>abs hash - capacity:num<span class="Special"> <- </span>get *table, <span class="Constant">capacity:offset</span> - _, hash<span class="Special"> <- </span>divide-with-remainder hash, capacity - hash<span class="Special"> <- </span>abs hash <span class="Comment"># in case hash overflows into a negative integer</span> - table-data:&:@:table_row:_key:_value<span class="Special"> <- </span>get *table, <span class="Constant">data:offset</span> - x:table_row:_key:_value<span class="Special"> <- </span>index *table-data, hash - occupied?:bool<span class="Special"> <- </span>get x, <span class="Constant">occupied?:offset</span> + hash:num <span class="Special"><-</span> hash key + hash <span class="Special"><-</span> abs hash + capacity:num <span class="Special"><-</span> get *table, <span class="Constant">capacity:offset</span> + _, hash <span class="Special"><-</span> divide-with-remainder hash, capacity + hash <span class="Special"><-</span> abs hash <span class="Comment"># in case hash overflows into a negative integer</span> + table-data:&:@:table_row:_key:_value <span class="Special"><-</span> get *table, <span class="Constant">data:offset</span> + x:table_row:_key:_value <span class="Special"><-</span> index *table-data, hash + occupied?:bool <span class="Special"><-</span> get x, <span class="Constant">occupied?:offset</span> assert occupied?, <span class="Constant">[can't handle missing elements yet]</span> - result<span class="Special"> <- </span>get x, <span class="Constant">value:offset</span> + result <span class="Special"><-</span> get x, <span class="Constant">value:offset</span> ] </pre> </body> |