diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2017-04-18 11:33:33 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2017-04-18 11:33:33 -0700 |
commit | 6c52e24e2996a77aa6297b26159003d503aef8a0 (patch) | |
tree | 7546851659eca4b166e42c4a5f236caf0a2281f1 | |
parent | bd58d18a2308ae5b53a6f5df1e67203739396d8f (diff) | |
download | mu-6c52e24e2996a77aa6297b26159003d503aef8a0.tar.gz |
3830 - crosslink shape-shifting containers in html
27 files changed, 567 insertions, 567 deletions
diff --git a/exuberant_ctags_rc b/exuberant_ctags_rc index b3057d9a..e8a6828a 100644 --- a/exuberant_ctags_rc +++ b/exuberant_ctags_rc @@ -4,7 +4,7 @@ --regex-mu=/^def![ \t]+([^ \t]*)/\1/d,definition/ --regex-mu=/^recipe[ \t]+([^ \t]*)/\1/d,definition/ --regex-mu=/^recipe![ \t]+([^ \t]*)/\1/d,definition/ ---regex-mu=/^container[ \t]+([^ \t]*)/\1/s,struct/ ---regex-mu=/^exclusive-container[ \t]+([^ \t]*)/\1/u,union/ +--regex-mu=/^container[ \t]+([^ \t:]*)/\1/s,struct/ +--regex-mu=/^exclusive-container[ \t]+([^ \t:]*)/\1/u,union/ --regex-mu=/$x/x/x/e/ --------- next option is for way-points in Mu --regex-mu=/^[ \t]*(<[^ \t]*>)/\1/d,definition/ diff --git a/html/061text.mu.html b/html/061text.mu.html index 0a5b7a4e..bc269d39 100644 --- a/html/061text.mu.html +++ b/html/061text.mu.html @@ -185,12 +185,12 @@ if ('onhashchange' in window) { <span id="L123" class="LineNr"> 123 </span>] <span id="L124" class="LineNr"> 124 </span> <span id="L125" class="LineNr"> 125 </span><span class="Comment"># A new type to help incrementally construct texts.</span> -<span id="L126" class="LineNr"> 126 </span><span class="muData">container</span> buffer:_elem [ +<span id="L126" class="LineNr"> 126 </span><span class="muData">container</span> <a href='061text.mu.html#L126'>buffer</a>:_elem [ <span id="L127" class="LineNr"> 127 </span> length:num <span id="L128" class="LineNr"> 128 </span> data:&:@:_elem <span id="L129" class="LineNr"> 129 </span>] <span id="L130" class="LineNr"> 130 </span> -<span id="L131" class="LineNr"> 131 </span><span class="muRecipe">def</span> <a href='061text.mu.html#L131'>new-buffer</a> <a href='075channel.mu.html#L379'>capacity</a>:num<span class="muRecipe"> -> </span>result:&:buffer:_elem [ +<span id="L131" class="LineNr"> 131 </span><span class="muRecipe">def</span> <a href='061text.mu.html#L131'>new-buffer</a> <a href='075channel.mu.html#L379'>capacity</a>:num<span class="muRecipe"> -> </span>result:&:<a href='061text.mu.html#L126'>buffer</a>:_elem [ <span id="L132" class="LineNr"> 132 </span> <span class="Constant">local-scope</span> <span id="L133" class="LineNr"> 133 </span> <span class="Constant">load-ingredients</span> <span id="L134" class="LineNr"> 134 </span> result <span class="Special"><-</span> new <span class="Delimiter">{</span>(buffer _elem): type<span class="Delimiter">}</span> @@ -205,7 +205,7 @@ if ('onhashchange' in window) { <span id="L143" class="LineNr"> 143 </span> <span class="muControl">return</span> result <span id="L144" class="LineNr"> 144 </span>] <span id="L145" class="LineNr"> 145 </span> -<span id="L146" class="LineNr"> 146 </span><span class="muRecipe">def</span> <a href='061text.mu.html#L146'>grow-buffer</a> buf:&:buffer:_elem<span class="muRecipe"> -> </span>buf:&:buffer:_elem [ +<span id="L146" class="LineNr"> 146 </span><span class="muRecipe">def</span> <a href='061text.mu.html#L146'>grow-buffer</a> buf:&:<a href='061text.mu.html#L126'>buffer</a>:_elem<span class="muRecipe"> -> </span>buf:&:<a href='061text.mu.html#L126'>buffer</a>:_elem [ <span id="L147" class="LineNr"> 147 </span> <span class="Constant">local-scope</span> <span id="L148" class="LineNr"> 148 </span> <span class="Constant">load-ingredients</span> <span id="L149" class="LineNr"> 149 </span> <span class="Comment"># double buffer size</span> @@ -226,7 +226,7 @@ if ('onhashchange' in window) { <span id="L164" class="LineNr"> 164 </span> <span class="Delimiter">}</span> <span id="L165" class="LineNr"> 165 </span>] <span id="L166" class="LineNr"> 166 </span> -<span id="L167" class="LineNr"> 167 </span><span class="muRecipe">def</span> <a href='061text.mu.html#L167'>buffer-full?</a> in:&:buffer:_elem<span class="muRecipe"> -> </span>result:bool [ +<span id="L167" class="LineNr"> 167 </span><span class="muRecipe">def</span> <a href='061text.mu.html#L167'>buffer-full?</a> in:&:<a href='061text.mu.html#L126'>buffer</a>:_elem<span class="muRecipe"> -> </span>result:bool [ <span id="L168" class="LineNr"> 168 </span> <span class="Constant">local-scope</span> <span id="L169" class="LineNr"> 169 </span> <span class="Constant">load-ingredients</span> <span id="L170" class="LineNr"> 170 </span> len:num <span class="Special"><-</span> get *in, <span class="Constant">length:offset</span> @@ -236,7 +236,7 @@ if ('onhashchange' in window) { <span id="L174" class="LineNr"> 174 </span>] <span id="L175" class="LineNr"> 175 </span> <span id="L176" class="LineNr"> 176 </span><span class="Comment"># most broadly applicable definition of append to a buffer: just call to-text</span> -<span id="L177" class="LineNr"> 177 </span><span class="muRecipe">def</span> append buf:&:buffer:char, x:_elem<span class="muRecipe"> -> </span>buf:&:buffer:char [ +<span id="L177" class="LineNr"> 177 </span><span class="muRecipe">def</span> append buf:&:<a href='061text.mu.html#L126'>buffer</a>:char, x:_elem<span class="muRecipe"> -> </span>buf:&:<a href='061text.mu.html#L126'>buffer</a>:char [ <span id="L178" class="LineNr"> 178 </span> <span class="Constant">local-scope</span> <span id="L179" class="LineNr"> 179 </span> <span class="Constant">load-ingredients</span> <span id="L180" class="LineNr"> 180 </span> text:text <span class="Special"><-</span> to-text x @@ -252,7 +252,7 @@ if ('onhashchange' in window) { <span id="L190" class="LineNr"> 190 </span> <span class="Delimiter">}</span> <span id="L191" class="LineNr"> 191 </span>] <span id="L192" class="LineNr"> 192 </span> -<span id="L193" class="LineNr"> 193 </span><span class="muRecipe">def</span> append buf:&:buffer:char, c:char<span class="muRecipe"> -> </span>buf:&:buffer:char [ +<span id="L193" class="LineNr"> 193 </span><span class="muRecipe">def</span> append buf:&:<a href='061text.mu.html#L126'>buffer</a>:char, c:char<span class="muRecipe"> -> </span>buf:&:<a href='061text.mu.html#L126'>buffer</a>:char [ <span id="L194" class="LineNr"> 194 </span> <span class="Constant">local-scope</span> <span id="L195" class="LineNr"> 195 </span> <span class="Constant">load-ingredients</span> <span id="L196" class="LineNr"> 196 </span> len:num <span class="Special"><-</span> get *buf, <span class="Constant">length:offset</span> @@ -278,7 +278,7 @@ if ('onhashchange' in window) { <span id="L216" class="LineNr"> 216 </span> *buf <span class="Special"><-</span> put *buf, <span class="Constant">length:offset</span>, len <span id="L217" class="LineNr"> 217 </span>] <span id="L218" class="LineNr"> 218 </span> -<span id="L219" class="LineNr"> 219 </span><span class="muRecipe">def</span> append buf:&:buffer:char, t:text<span class="muRecipe"> -> </span>buf:&:buffer:char [ +<span id="L219" class="LineNr"> 219 </span><span class="muRecipe">def</span> append buf:&:<a href='061text.mu.html#L126'>buffer</a>:char, t:text<span class="muRecipe"> -> </span>buf:&:<a href='061text.mu.html#L126'>buffer</a>:char [ <span id="L220" class="LineNr"> 220 </span> <span class="Constant">local-scope</span> <span id="L221" class="LineNr"> 221 </span> <span class="Constant">load-ingredients</span> <span id="L222" class="LineNr"> 222 </span> len:num <span class="Special"><-</span> length *t @@ -295,7 +295,7 @@ if ('onhashchange' in window) { <span id="L233" class="LineNr"> 233 </span> <span id="L234" class="LineNr"> 234 </span><span class="muScenario">scenario</span> append-to-empty-buffer [ <span id="L235" class="LineNr"> 235 </span> <span class="Constant">local-scope</span> -<span id="L236" class="LineNr"> 236 </span> x:&:buffer:char <span class="Special"><-</span> <a href='061text.mu.html#L131'>new-buffer</a> +<span id="L236" class="LineNr"> 236 </span> x:&:<a href='061text.mu.html#L126'>buffer</a>:char <span class="Special"><-</span> <a href='061text.mu.html#L131'>new-buffer</a> <span id="L237" class="LineNr"> 237 </span> run [ <span id="L238" class="LineNr"> 238 </span> <span class="Conceal">¦</span> c:char <span class="Special"><-</span> copy <span class="Constant">97/a</span> <span id="L239" class="LineNr"> 239 </span> <span class="Conceal">¦</span> x <span class="Special"><-</span> append x, c @@ -313,7 +313,7 @@ if ('onhashchange' in window) { <span id="L251" class="LineNr"> 251 </span> <span id="L252" class="LineNr"> 252 </span><span class="muScenario">scenario</span> append-to-buffer [ <span id="L253" class="LineNr"> 253 </span> <span class="Constant">local-scope</span> -<span id="L254" class="LineNr"> 254 </span> x:&:buffer:char <span class="Special"><-</span> <a href='061text.mu.html#L131'>new-buffer</a> +<span id="L254" class="LineNr"> 254 </span> x:&:<a href='061text.mu.html#L126'>buffer</a>:char <span class="Special"><-</span> <a href='061text.mu.html#L131'>new-buffer</a> <span id="L255" class="LineNr"> 255 </span> c:char <span class="Special"><-</span> copy <span class="Constant">97/a</span> <span id="L256" class="LineNr"> 256 </span> x <span class="Special"><-</span> append x, c <span id="L257" class="LineNr"> 257 </span> run [ @@ -335,7 +335,7 @@ if ('onhashchange' in window) { <span id="L273" class="LineNr"> 273 </span> <span id="L274" class="LineNr"> 274 </span><span class="muScenario">scenario</span> append-grows-buffer [ <span id="L275" class="LineNr"> 275 </span> <span class="Constant">local-scope</span> -<span id="L276" class="LineNr"> 276 </span> x:&:buffer:char <span class="Special"><-</span> <a href='061text.mu.html#L131'>new-buffer</a><span class="Constant"> 3</span> +<span id="L276" class="LineNr"> 276 </span> x:&:<a href='061text.mu.html#L126'>buffer</a>:char <span class="Special"><-</span> <a href='061text.mu.html#L131'>new-buffer</a><span class="Constant"> 3</span> <span id="L277" class="LineNr"> 277 </span> s1:text <span class="Special"><-</span> get *x, <span class="Constant">data:offset</span> <span id="L278" class="LineNr"> 278 </span> x <span class="Special"><-</span> append x, <span class="Constant">[abc]</span> <span class="Comment"># buffer is now full</span> <span id="L279" class="LineNr"> 279 </span> s2:text <span class="Special"><-</span> get *x, <span class="Constant">data:offset</span> @@ -372,7 +372,7 @@ if ('onhashchange' in window) { <span id="L310" class="LineNr"> 310 </span> <span id="L311" class="LineNr"> 311 </span><span class="muScenario">scenario</span> buffer-append-handles-backspace [ <span id="L312" class="LineNr"> 312 </span> <span class="Constant">local-scope</span> -<span id="L313" class="LineNr"> 313 </span> x:&:buffer:char <span class="Special"><-</span> <a href='061text.mu.html#L131'>new-buffer</a> +<span id="L313" class="LineNr"> 313 </span> x:&:<a href='061text.mu.html#L126'>buffer</a>:char <span class="Special"><-</span> <a href='061text.mu.html#L131'>new-buffer</a> <span id="L314" class="LineNr"> 314 </span> x <span class="Special"><-</span> append x, <span class="Constant">[ab]</span> <span id="L315" class="LineNr"> 315 </span> run [ <span id="L316" class="LineNr"> 316 </span> <span class="Conceal">¦</span> c:char <span class="Special"><-</span> copy <span class="Constant">8/backspace</span> @@ -387,7 +387,7 @@ if ('onhashchange' in window) { <span id="L325" class="LineNr"> 325 </span> ] <span id="L326" class="LineNr"> 326 </span>] <span id="L327" class="LineNr"> 327 </span> -<span id="L328" class="LineNr"> 328 </span><span class="muRecipe">def</span> <a href='061text.mu.html#L328'>buffer-to-array</a> in:&:buffer:_elem<span class="muRecipe"> -> </span>result:&:@:_elem [ +<span id="L328" class="LineNr"> 328 </span><span class="muRecipe">def</span> <a href='061text.mu.html#L328'>buffer-to-array</a> in:&:<a href='061text.mu.html#L126'>buffer</a>:_elem<span class="muRecipe"> -> </span>result:&:@:_elem [ <span id="L329" class="LineNr"> 329 </span> <span class="Constant">local-scope</span> <span id="L330" class="LineNr"> 330 </span> <span class="Constant">load-ingredients</span> <span id="L331" class="LineNr"> 331 </span> <span class="Delimiter">{</span> @@ -421,7 +421,7 @@ if ('onhashchange' in window) { <span id="L359" class="LineNr"> 359 </span><span class="muRecipe">def</span> append first:text<span class="muRecipe"> -> </span>result:text [ <span id="L360" class="LineNr"> 360 </span> <span class="Constant">local-scope</span> <span id="L361" class="LineNr"> 361 </span> <span class="Constant">load-ingredients</span> -<span id="L362" class="LineNr"> 362 </span> buf:&:buffer:char <span class="Special"><-</span> <a href='061text.mu.html#L131'>new-buffer</a><span class="Constant"> 30</span> +<span id="L362" class="LineNr"> 362 </span> buf:&:<a href='061text.mu.html#L126'>buffer</a>:char <span class="Special"><-</span> <a href='061text.mu.html#L131'>new-buffer</a><span class="Constant"> 30</span> <span id="L363" class="LineNr"> 363 </span> <span class="Comment"># append first ingredient</span> <span id="L364" class="LineNr"> 364 </span> <span class="Delimiter">{</span> <span id="L365" class="LineNr"> 365 </span> <span class="Conceal">¦</span> <span class="muControl">break-unless</span> first diff --git a/html/064list.mu.html b/html/064list.mu.html index e1f93300..3f604a5e 100644 --- a/html/064list.mu.html +++ b/html/064list.mu.html @@ -65,26 +65,26 @@ if ('onhashchange' in window) { <span id="L3" class="LineNr"> 3 </span><span class="Comment"># The objects must be of the same type. If you want to store multiple types in</span> <span id="L4" class="LineNr"> 4 </span><span class="Comment"># a single list, use an exclusive-container.</span> <span id="L5" class="LineNr"> 5 </span> -<span id="L6" class="LineNr"> 6 </span><span class="muData">container</span> list:_elem [ +<span id="L6" class="LineNr"> 6 </span><span class="muData">container</span> <a href='064list.mu.html#L6'>list</a>:_elem [ <span id="L7" class="LineNr"> 7 </span> value:_elem -<span id="L8" class="LineNr"> 8 </span> <a href='065duplex_list.mu.html#L29'>next</a>:&:list:_elem +<span id="L8" class="LineNr"> 8 </span> <a href='065duplex_list.mu.html#L29'>next</a>:&:<a href='064list.mu.html#L6'>list</a>:_elem <span id="L9" class="LineNr"> 9 </span>] <span id="L10" class="LineNr"> 10 </span> -<span id="L11" class="LineNr"> 11 </span><span class="muRecipe">def</span> push x:_elem, l:&:list:_elem<span class="muRecipe"> -> </span>l:&:list:_elem [ +<span id="L11" class="LineNr"> 11 </span><span class="muRecipe">def</span> push x:_elem, l:&:<a href='064list.mu.html#L6'>list</a>:_elem<span class="muRecipe"> -> </span>l:&:<a href='064list.mu.html#L6'>list</a>:_elem [ <span id="L12" class="LineNr"> 12 </span> <span class="Constant">local-scope</span> <span id="L13" class="LineNr"> 13 </span> <span class="Constant">load-ingredients</span> -<span id="L14" class="LineNr"> 14 </span> result:&:list:_elem <span class="Special"><-</span> new <span class="Delimiter">{</span>(list _elem): type<span class="Delimiter">}</span> +<span id="L14" class="LineNr"> 14 </span> result:&:<a href='064list.mu.html#L6'>list</a>:_elem <span class="Special"><-</span> new <span class="Delimiter">{</span>(list _elem): type<span class="Delimiter">}</span> <span id="L15" class="LineNr"> 15 </span> *result <span class="Special"><-</span> merge x, l <span id="L16" class="LineNr"> 16 </span> <span class="muControl">return</span> result <span id="L17" class="LineNr"> 17 </span>] <span id="L18" class="LineNr"> 18 </span> -<span id="L19" class="LineNr"> 19 </span><span class="muRecipe">def</span> first in:&:list:_elem<span class="muRecipe"> -> </span>result:_elem [ +<span id="L19" class="LineNr"> 19 </span><span class="muRecipe">def</span> first in:&:<a href='064list.mu.html#L6'>list</a>:_elem<span class="muRecipe"> -> </span>result:_elem [ <span id="L20" class="LineNr"> 20 </span> <span class="Constant">local-scope</span> <span id="L21" class="LineNr"> 21 </span> <span class="Constant">load-ingredients</span> <span id="L22" class="LineNr"> 22 </span> result <span class="Special"><-</span> get *in, <span class="Constant">value:offset</span> <span id="L23" class="LineNr"> 23 </span>] <span id="L24" class="LineNr"> 24 </span> -<span id="L25" class="LineNr"> 25 </span><span class="muRecipe">def</span> <a href='064list.mu.html#L25'>rest</a> in:&:list:_elem<span class="muRecipe"> -> </span>result:&:list:_elem/contained-in:in [ +<span id="L25" class="LineNr"> 25 </span><span class="muRecipe">def</span> <a href='064list.mu.html#L25'>rest</a> in:&:<a href='064list.mu.html#L6'>list</a>:_elem<span class="muRecipe"> -> </span>result:&:<a href='064list.mu.html#L6'>list</a>:_elem/contained-in:in [ <span id="L26" class="LineNr"> 26 </span> <span class="Constant">local-scope</span> <span id="L27" class="LineNr"> 27 </span> <span class="Constant">load-ingredients</span> <span id="L28" class="LineNr"> 28 </span> result <span class="Special"><-</span> get *in, <span class="Constant"><a href='065duplex_list.mu.html#L29'>next</a>:offset</span> @@ -93,7 +93,7 @@ if ('onhashchange' in window) { <span id="L31" class="LineNr"> 31 </span><span class="muScenario">scenario</span> list-handling [ <span id="L32" class="LineNr"> 32 </span> run [ <span id="L33" class="LineNr"> 33 </span> <span class="Conceal">¦</span> <span class="Constant">local-scope</span> -<span id="L34" class="LineNr"> 34 </span> <span class="Conceal">¦</span> x:&:list:num <span class="Special"><-</span> push<span class="Constant"> 3</span>,<span class="Constant"> 0</span> +<span id="L34" class="LineNr"> 34 </span> <span class="Conceal">¦</span> x:&:<a href='064list.mu.html#L6'>list</a>:num <span class="Special"><-</span> push<span class="Constant"> 3</span>,<span class="Constant"> 0</span> <span id="L35" class="LineNr"> 35 </span> <span class="Conceal">¦</span> x <span class="Special"><-</span> push<span class="Constant"> 4</span>, x <span id="L36" class="LineNr"> 36 </span> <span class="Conceal">¦</span> x <span class="Special"><-</span> push<span class="Constant"> 5</span>, x <span id="L37" class="LineNr"> 37 </span> <span class="Conceal">¦</span> 10:num/<span class="Special">raw</span> <span class="Special"><-</span> first x @@ -101,7 +101,7 @@ if ('onhashchange' in window) { <span id="L39" class="LineNr"> 39 </span> <span class="Conceal">¦</span> 11:num/<span class="Special">raw</span> <span class="Special"><-</span> first x <span id="L40" class="LineNr"> 40 </span> <span class="Conceal">¦</span> x <span class="Special"><-</span> <a href='064list.mu.html#L25'>rest</a> x <span id="L41" class="LineNr"> 41 </span> <span class="Conceal">¦</span> 12:num/<span class="Special">raw</span> <span class="Special"><-</span> first x -<span id="L42" class="LineNr"> 42 </span> <span class="Conceal">¦</span> 20:&:list:num/<span class="Special">raw</span> <span class="Special"><-</span> <a href='064list.mu.html#L25'>rest</a> x +<span id="L42" class="LineNr"> 42 </span> <span class="Conceal">¦</span> 20:&:<a href='064list.mu.html#L6'>list</a>:num/<span class="Special">raw</span> <span class="Special"><-</span> <a href='064list.mu.html#L25'>rest</a> x <span id="L43" class="LineNr"> 43 </span> ] <span id="L44" class="LineNr"> 44 </span> memory-should-contain [ <span id="L45" class="LineNr"> 45 </span> <span class="Conceal">¦</span><span class="Constant"> 10</span> <span class="Special"><-</span><span class="Constant"> 5</span> @@ -111,7 +111,7 @@ if ('onhashchange' in window) { <span id="L49" class="LineNr"> 49 </span> ] <span id="L50" class="LineNr"> 50 </span>] <span id="L51" class="LineNr"> 51 </span> -<span id="L52" class="LineNr"> 52 </span><span class="muRecipe">def</span> length l:&:list:_elem<span class="muRecipe"> -> </span>result:num [ +<span id="L52" class="LineNr"> 52 </span><span class="muRecipe">def</span> length l:&:<a href='064list.mu.html#L6'>list</a>:_elem<span class="muRecipe"> -> </span>result:num [ <span id="L53" class="LineNr"> 53 </span> <span class="Constant">local-scope</span> <span id="L54" class="LineNr"> 54 </span> <span class="Constant">load-ingredients</span> <span id="L55" class="LineNr"> 55 </span> result <span class="Special"><-</span> copy<span class="Constant"> 0</span> @@ -124,26 +124,26 @@ if ('onhashchange' in window) { <span id="L62" class="LineNr"> 62 </span>] <span id="L63" class="LineNr"> 63 </span> <span id="L64" class="LineNr"> 64 </span><span class="Comment"># insert 'x' after 'in'</span> -<span id="L65" class="LineNr"> 65 </span><span class="muRecipe">def</span> insert x:_elem, in:&:list:_elem<span class="muRecipe"> -> </span>in:&:list:_elem [ +<span id="L65" class="LineNr"> 65 </span><span class="muRecipe">def</span> insert x:_elem, in:&:<a href='064list.mu.html#L6'>list</a>:_elem<span class="muRecipe"> -> </span>in:&:<a href='064list.mu.html#L6'>list</a>:_elem [ <span id="L66" class="LineNr"> 66 </span> <span class="Constant">local-scope</span> <span id="L67" class="LineNr"> 67 </span> <span class="Constant">load-ingredients</span> -<span id="L68" class="LineNr"> 68 </span> new-node:&:list:_elem <span class="Special"><-</span> new <span class="Delimiter">{</span>(list _elem): type<span class="Delimiter">}</span> +<span id="L68" class="LineNr"> 68 </span> new-node:&:<a href='064list.mu.html#L6'>list</a>:_elem <span class="Special"><-</span> new <span class="Delimiter">{</span>(list _elem): type<span class="Delimiter">}</span> <span id="L69" class="LineNr"> 69 </span> *new-node <span class="Special"><-</span> put *new-node, <span class="Constant">value:offset</span>, x -<span id="L70" class="LineNr"> 70 </span> next-node:&:list:_elem <span class="Special"><-</span> get *in, <span class="Constant"><a href='065duplex_list.mu.html#L29'>next</a>:offset</span> +<span id="L70" class="LineNr"> 70 </span> next-node:&:<a href='064list.mu.html#L6'>list</a>:_elem <span class="Special"><-</span> get *in, <span class="Constant"><a href='065duplex_list.mu.html#L29'>next</a>:offset</span> <span id="L71" class="LineNr"> 71 </span> *in <span class="Special"><-</span> put *in, <span class="Constant"><a href='065duplex_list.mu.html#L29'>next</a>:offset</span>, new-node <span id="L72" class="LineNr"> 72 </span> *new-node <span class="Special"><-</span> put *new-node, <span class="Constant"><a href='065duplex_list.mu.html#L29'>next</a>:offset</span>, next-node <span id="L73" class="LineNr"> 73 </span>] <span id="L74" class="LineNr"> 74 </span> <span id="L75" class="LineNr"> 75 </span><span class="muScenario">scenario</span> inserting-into-list [ <span id="L76" class="LineNr"> 76 </span> <span class="Constant">local-scope</span> -<span id="L77" class="LineNr"> 77 </span> list:&:list:char <span class="Special"><-</span> push<span class="Constant"> 3</span>,<span class="Constant"> 0</span> -<span id="L78" class="LineNr"> 78 </span> list <span class="Special"><-</span> push<span class="Constant"> 4</span>, list -<span id="L79" class="LineNr"> 79 </span> list <span class="Special"><-</span> push<span class="Constant"> 5</span>, list +<span id="L77" class="LineNr"> 77 </span> <a href='064list.mu.html#L6'>list</a>:&:<a href='064list.mu.html#L6'>list</a>:char <span class="Special"><-</span> push<span class="Constant"> 3</span>,<span class="Constant"> 0</span> +<span id="L78" class="LineNr"> 78 </span> <a href='064list.mu.html#L6'>list</a> <span class="Special"><-</span> push<span class="Constant"> 4</span>, <a href='064list.mu.html#L6'>list</a> +<span id="L79" class="LineNr"> 79 </span> <a href='064list.mu.html#L6'>list</a> <span class="Special"><-</span> push<span class="Constant"> 5</span>, <a href='064list.mu.html#L6'>list</a> <span id="L80" class="LineNr"> 80 </span> run [ -<span id="L81" class="LineNr"> 81 </span> <span class="Conceal">¦</span> list2:&:list:char <span class="Special"><-</span> <a href='064list.mu.html#L25'>rest</a> list <span class="Comment"># inside list</span> +<span id="L81" class="LineNr"> 81 </span> <span class="Conceal">¦</span> list2:&:<a href='064list.mu.html#L6'>list</a>:char <span class="Special"><-</span> <a href='064list.mu.html#L25'>rest</a> <a href='064list.mu.html#L6'>list</a> <span class="Comment"># inside list</span> <span id="L82" class="LineNr"> 82 </span> <span class="Conceal">¦</span> list2 <span class="Special"><-</span> insert<span class="Constant"> 6</span>, list2 <span id="L83" class="LineNr"> 83 </span> <span class="Conceal">¦</span> <span class="Comment"># check structure</span> -<span id="L84" class="LineNr"> 84 </span> <span class="Conceal">¦</span> list2 <span class="Special"><-</span> copy list +<span id="L84" class="LineNr"> 84 </span> <span class="Conceal">¦</span> list2 <span class="Special"><-</span> copy <a href='064list.mu.html#L6'>list</a> <span id="L85" class="LineNr"> 85 </span> <span class="Conceal">¦</span> 10:char/<span class="Special">raw</span> <span class="Special"><-</span> first list2 <span id="L86" class="LineNr"> 86 </span> <span class="Conceal">¦</span> list2 <span class="Special"><-</span> <a href='064list.mu.html#L25'>rest</a> list2 <span id="L87" class="LineNr"> 87 </span> <span class="Conceal">¦</span> 11:char/<span class="Special">raw</span> <span class="Special"><-</span> first list2 @@ -162,15 +162,15 @@ if ('onhashchange' in window) { <span id="L100" class="LineNr">100 </span> <span id="L101" class="LineNr">101 </span><span class="muScenario">scenario</span> inserting-at-end-of-list [ <span id="L102" class="LineNr">102 </span> <span class="Constant">local-scope</span> -<span id="L103" class="LineNr">103 </span> list:&:list:char <span class="Special"><-</span> push<span class="Constant"> 3</span>,<span class="Constant"> 0</span> -<span id="L104" class="LineNr">104 </span> list <span class="Special"><-</span> push<span class="Constant"> 4</span>, list -<span id="L105" class="LineNr">105 </span> list <span class="Special"><-</span> push<span class="Constant"> 5</span>, list +<span id="L103" class="LineNr">103 </span> <a href='064list.mu.html#L6'>list</a>:&:<a href='064list.mu.html#L6'>list</a>:char <span class="Special"><-</span> push<span class="Constant"> 3</span>,<span class="Constant"> 0</span> +<span id="L104" class="LineNr">104 </span> <a href='064list.mu.html#L6'>list</a> <span class="Special"><-</span> push<span class="Constant"> 4</span>, <a href='064list.mu.html#L6'>list</a> +<span id="L105" class="LineNr">105 </span> <a href='064list.mu.html#L6'>list</a> <span class="Special"><-</span> push<span class="Constant"> 5</span>, <a href='064list.mu.html#L6'>list</a> <span id="L106" class="LineNr">106 </span> run [ -<span id="L107" class="LineNr">107 </span> <span class="Conceal">¦</span> list2:&:list:char <span class="Special"><-</span> <a href='064list.mu.html#L25'>rest</a> list <span class="Comment"># inside list</span> +<span id="L107" class="LineNr">107 </span> <span class="Conceal">¦</span> list2:&:<a href='064list.mu.html#L6'>list</a>:char <span class="Special"><-</span> <a href='064list.mu.html#L25'>rest</a> <a href='064list.mu.html#L6'>list</a> <span class="Comment"># inside list</span> <span id="L108" class="LineNr">108 </span> <span class="Conceal">¦</span> list2 <span class="Special"><-</span> <a href='064list.mu.html#L25'>rest</a> list2 <span class="Comment"># now at end of list</span> <span id="L109" class="LineNr">109 </span> <span class="Conceal">¦</span> list2 <span class="Special"><-</span> insert<span class="Constant"> 6</span>, list2 <span id="L110" class="LineNr">110 </span> <span class="Conceal">¦</span> <span class="Comment"># check structure like before</span> -<span id="L111" class="LineNr">111 </span> <span class="Conceal">¦</span> list2 <span class="Special"><-</span> copy list +<span id="L111" class="LineNr">111 </span> <span class="Conceal">¦</span> list2 <span class="Special"><-</span> copy <a href='064list.mu.html#L6'>list</a> <span id="L112" class="LineNr">112 </span> <span class="Conceal">¦</span> 10:char/<span class="Special">raw</span> <span class="Special"><-</span> first list2 <span id="L113" class="LineNr">113 </span> <span class="Conceal">¦</span> list2 <span class="Special"><-</span> <a href='064list.mu.html#L25'>rest</a> list2 <span id="L114" class="LineNr">114 </span> <span class="Conceal">¦</span> 11:char/<span class="Special">raw</span> <span class="Special"><-</span> first list2 @@ -189,13 +189,13 @@ if ('onhashchange' in window) { <span id="L127" class="LineNr">127 </span> <span id="L128" class="LineNr">128 </span><span class="muScenario">scenario</span> inserting-after-start-of-list [ <span id="L129" class="LineNr">129 </span> <span class="Constant">local-scope</span> -<span id="L130" class="LineNr">130 </span> list:&:list:char <span class="Special"><-</span> push<span class="Constant"> 3</span>,<span class="Constant"> 0</span> -<span id="L131" class="LineNr">131 </span> list <span class="Special"><-</span> push<span class="Constant"> 4</span>, list -<span id="L132" class="LineNr">132 </span> list <span class="Special"><-</span> push<span class="Constant"> 5</span>, list +<span id="L130" class="LineNr">130 </span> <a href='064list.mu.html#L6'>list</a>:&:<a href='064list.mu.html#L6'>list</a>:char <span class="Special"><-</span> push<span class="Constant"> 3</span>,<span class="Constant"> 0</span> +<span id="L131" class="LineNr">131 </span> <a href='064list.mu.html#L6'>list</a> <span class="Special"><-</span> push<span class="Constant"> 4</span>, <a href='064list.mu.html#L6'>list</a> +<span id="L132" class="LineNr">132 </span> <a href='064list.mu.html#L6'>list</a> <span class="Special"><-</span> push<span class="Constant"> 5</span>, <a href='064list.mu.html#L6'>list</a> <span id="L133" class="LineNr">133 </span> run [ -<span id="L134" class="LineNr">134 </span> <span class="Conceal">¦</span> list <span class="Special"><-</span> insert<span class="Constant"> 6</span>, list +<span id="L134" class="LineNr">134 </span> <span class="Conceal">¦</span> <a href='064list.mu.html#L6'>list</a> <span class="Special"><-</span> insert<span class="Constant"> 6</span>, <a href='064list.mu.html#L6'>list</a> <span id="L135" class="LineNr">135 </span> <span class="Conceal">¦</span> <span class="Comment"># check structure like before</span> -<span id="L136" class="LineNr">136 </span> <span class="Conceal">¦</span> list2:&:list:char <span class="Special"><-</span> copy list +<span id="L136" class="LineNr">136 </span> <span class="Conceal">¦</span> list2:&:<a href='064list.mu.html#L6'>list</a>:char <span class="Special"><-</span> copy <a href='064list.mu.html#L6'>list</a> <span id="L137" class="LineNr">137 </span> <span class="Conceal">¦</span> 10:char/<span class="Special">raw</span> <span class="Special"><-</span> first list2 <span id="L138" class="LineNr">138 </span> <span class="Conceal">¦</span> list2 <span class="Special"><-</span> <a href='064list.mu.html#L25'>rest</a> list2 <span id="L139" class="LineNr">139 </span> <span class="Conceal">¦</span> 11:char/<span class="Special">raw</span> <span class="Special"><-</span> first list2 @@ -216,20 +216,20 @@ if ('onhashchange' in window) { <span id="L154" class="LineNr">154 </span><span class="Comment">#</span> <span id="L155" class="LineNr">155 </span><span class="Comment"># Returns null if and only if list is empty. Beware: in that case any other</span> <span id="L156" class="LineNr">156 </span><span class="Comment"># pointers to the head are now invalid.</span> -<span id="L157" class="LineNr">157 </span><span class="muRecipe">def</span> remove x:&:list:_elem/contained-in:in, in:&:list:_elem<span class="muRecipe"> -> </span>in:&:list:_elem [ +<span id="L157" class="LineNr">157 </span><span class="muRecipe">def</span> remove x:&:<a href='064list.mu.html#L6'>list</a>:_elem/contained-in:in, in:&:<a href='064list.mu.html#L6'>list</a>:_elem<span class="muRecipe"> -> </span>in:&:<a href='064list.mu.html#L6'>list</a>:_elem [ <span id="L158" class="LineNr">158 </span> <span class="Constant">local-scope</span> <span id="L159" class="LineNr">159 </span> <span class="Constant">load-ingredients</span> <span id="L160" class="LineNr">160 </span> <span class="Comment"># if 'x' is null, return</span> <span id="L161" class="LineNr">161 </span> <span class="muControl">return-unless</span> x -<span id="L162" class="LineNr">162 </span> next-node:&:list:_elem <span class="Special"><-</span> <a href='064list.mu.html#L25'>rest</a> x +<span id="L162" class="LineNr">162 </span> next-node:&:<a href='064list.mu.html#L6'>list</a>:_elem <span class="Special"><-</span> <a href='064list.mu.html#L25'>rest</a> x <span id="L163" class="LineNr">163 </span> <span class="Comment"># clear next pointer of 'x'</span> <span id="L164" class="LineNr">164 </span> *x <span class="Special"><-</span> put *x, <span class="Constant"><a href='065duplex_list.mu.html#L29'>next</a>:offset</span>,<span class="Constant"> 0</span> <span id="L165" class="LineNr">165 </span> <span class="Comment"># if 'x' is at the head of 'in', return the new head</span> <span id="L166" class="LineNr">166 </span> at-head?:bool <span class="Special"><-</span> equal x, in <span id="L167" class="LineNr">167 </span> <span class="muControl">return-if</span> at-head?, next-node <span id="L168" class="LineNr">168 </span> <span class="Comment"># compute prev-node</span> -<span id="L169" class="LineNr">169 </span> prev-node:&:list:_elem <span class="Special"><-</span> copy in -<span id="L170" class="LineNr">170 </span> curr:&:list:_elem <span class="Special"><-</span> <a href='064list.mu.html#L25'>rest</a> prev-node +<span id="L169" class="LineNr">169 </span> prev-node:&:<a href='064list.mu.html#L6'>list</a>:_elem <span class="Special"><-</span> copy in +<span id="L170" class="LineNr">170 </span> curr:&:<a href='064list.mu.html#L6'>list</a>:_elem <span class="Special"><-</span> <a href='064list.mu.html#L25'>rest</a> prev-node <span id="L171" class="LineNr">171 </span> <span class="Delimiter">{</span> <span id="L172" class="LineNr">172 </span> <span class="Conceal">¦</span> <span class="muControl">return-unless</span> curr <span id="L173" class="LineNr">173 </span> <span class="Conceal">¦</span> found?:bool <span class="Special"><-</span> equal curr, x @@ -243,19 +243,19 @@ if ('onhashchange' in window) { <span id="L181" class="LineNr">181 </span> <span id="L182" class="LineNr">182 </span><span class="muScenario">scenario</span> removing-from-list [ <span id="L183" class="LineNr">183 </span> <span class="Constant">local-scope</span> -<span id="L184" class="LineNr">184 </span> list:&:list:char <span class="Special"><-</span> push<span class="Constant"> 3</span>,<span class="Constant"> 0</span> -<span id="L185" class="LineNr">185 </span> list <span class="Special"><-</span> push<span class="Constant"> 4</span>, list -<span id="L186" class="LineNr">186 </span> list <span class="Special"><-</span> push<span class="Constant"> 5</span>, list +<span id="L184" class="LineNr">184 </span> <a href='064list.mu.html#L6'>list</a>:&:<a href='064list.mu.html#L6'>list</a>:char <span class="Special"><-</span> push<span class="Constant"> 3</span>,<span class="Constant"> 0</span> +<span id="L185" class="LineNr">185 </span> <a href='064list.mu.html#L6'>list</a> <span class="Special"><-</span> push<span class="Constant"> 4</span>, <a href='064list.mu.html#L6'>list</a> +<span id="L186" class="LineNr">186 </span> <a href='064list.mu.html#L6'>list</a> <span class="Special"><-</span> push<span class="Constant"> 5</span>, <a href='064list.mu.html#L6'>list</a> <span id="L187" class="LineNr">187 </span> run [ -<span id="L188" class="LineNr">188 </span> <span class="Conceal">¦</span> list2:&:list:char <span class="Special"><-</span> <a href='064list.mu.html#L25'>rest</a> list <span class="Comment"># second element</span> -<span id="L189" class="LineNr">189 </span> <span class="Conceal">¦</span> list <span class="Special"><-</span> remove list2, list +<span id="L188" class="LineNr">188 </span> <span class="Conceal">¦</span> list2:&:<a href='064list.mu.html#L6'>list</a>:char <span class="Special"><-</span> <a href='064list.mu.html#L25'>rest</a> <a href='064list.mu.html#L6'>list</a> <span class="Comment"># second element</span> +<span id="L189" class="LineNr">189 </span> <span class="Conceal">¦</span> <a href='064list.mu.html#L6'>list</a> <span class="Special"><-</span> remove list2, <a href='064list.mu.html#L6'>list</a> <span id="L190" class="LineNr">190 </span> <span class="Conceal">¦</span> 10:bool/<span class="Special">raw</span> <span class="Special"><-</span> equal list2,<span class="Constant"> 0</span> <span id="L191" class="LineNr">191 </span> <span class="Conceal">¦</span> <span class="Comment"># check structure like before</span> -<span id="L192" class="LineNr">192 </span> <span class="Conceal">¦</span> list2 <span class="Special"><-</span> copy list +<span id="L192" class="LineNr">192 </span> <span class="Conceal">¦</span> list2 <span class="Special"><-</span> copy <a href='064list.mu.html#L6'>list</a> <span id="L193" class="LineNr">193 </span> <span class="Conceal">¦</span> 11:char/<span class="Special">raw</span> <span class="Special"><-</span> first list2 <span id="L194" class="LineNr">194 </span> <span class="Conceal">¦</span> list2 <span class="Special"><-</span> <a href='064list.mu.html#L25'>rest</a> list2 <span id="L195" class="LineNr">195 </span> <span class="Conceal">¦</span> 12:char/<span class="Special">raw</span> <span class="Special"><-</span> first list2 -<span id="L196" class="LineNr">196 </span> <span class="Conceal">¦</span> 20:&:list:char/<span class="Special">raw</span> <span class="Special"><-</span> <a href='064list.mu.html#L25'>rest</a> list2 +<span id="L196" class="LineNr">196 </span> <span class="Conceal">¦</span> 20:&:<a href='064list.mu.html#L6'>list</a>:char/<span class="Special">raw</span> <span class="Special"><-</span> <a href='064list.mu.html#L25'>rest</a> list2 <span id="L197" class="LineNr">197 </span> ] <span id="L198" class="LineNr">198 </span> memory-should-contain [ <span id="L199" class="LineNr">199 </span> <span class="Conceal">¦</span><span class="Constant"> 10</span> <span class="Special"><-</span><span class="Constant"> 0</span> <span class="Comment"># remove returned non-null</span> @@ -267,17 +267,17 @@ if ('onhashchange' in window) { <span id="L205" class="LineNr">205 </span> <span id="L206" class="LineNr">206 </span><span class="muScenario">scenario</span> removing-from-start-of-list [ <span id="L207" class="LineNr">207 </span> <span class="Constant">local-scope</span> -<span id="L208" class="LineNr">208 </span> list:&:list:char <span class="Special"><-</span> push<span class="Constant"> 3</span>,<span class="Constant"> 0</span> -<span id="L209" class="LineNr">209 </span> list <span class="Special"><-</span> push<span class="Constant"> 4</span>, list -<span id="L210" class="LineNr">210 </span> list <span class="Special"><-</span> push<span class="Constant"> 5</span>, list +<span id="L208" class="LineNr">208 </span> <a href='064list.mu.html#L6'>list</a>:&:<a href='064list.mu.html#L6'>list</a>:char <span class="Special"><-</span> push<span class="Constant"> 3</span>,<span class="Constant"> 0</span> +<span id="L209" class="LineNr">209 </span> <a href='064list.mu.html#L6'>list</a> <span class="Special"><-</span> push<span class="Constant"> 4</span>, <a href='064list.mu.html#L6'>list</a> +<span id="L210" class="LineNr">210 </span> <a href='064list.mu.html#L6'>list</a> <span class="Special"><-</span> push<span class="Constant"> 5</span>, <a href='064list.mu.html#L6'>list</a> <span id="L211" class="LineNr">211 </span> run [ -<span id="L212" class="LineNr">212 </span> <span class="Conceal">¦</span> list <span class="Special"><-</span> remove list, list +<span id="L212" class="LineNr">212 </span> <span class="Conceal">¦</span> <a href='064list.mu.html#L6'>list</a> <span class="Special"><-</span> remove <a href='064list.mu.html#L6'>list</a>, <a href='064list.mu.html#L6'>list</a> <span id="L213" class="LineNr">213 </span> <span class="Conceal">¦</span> <span class="Comment"># check structure like before</span> -<span id="L214" class="LineNr">214 </span> <span class="Conceal">¦</span> list2:&:list:char <span class="Special"><-</span> copy list +<span id="L214" class="LineNr">214 </span> <span class="Conceal">¦</span> list2:&:<a href='064list.mu.html#L6'>list</a>:char <span class="Special"><-</span> copy <a href='064list.mu.html#L6'>list</a> <span id="L215" class="LineNr">215 </span> <span class="Conceal">¦</span> 10:char/<span class="Special">raw</span> <span class="Special"><-</span> first list2 <span id="L216" class="LineNr">216 </span> <span class="Conceal">¦</span> list2 <span class="Special"><-</span> <a href='064list.mu.html#L25'>rest</a> list2 <span id="L217" class="LineNr">217 </span> <span class="Conceal">¦</span> 11:char/<span class="Special">raw</span> <span class="Special"><-</span> first list2 -<span id="L218" class="LineNr">218 </span> <span class="Conceal">¦</span> 20:&:list:char/<span class="Special">raw</span> <span class="Special"><-</span> <a href='064list.mu.html#L25'>rest</a> list2 +<span id="L218" class="LineNr">218 </span> <span class="Conceal">¦</span> 20:&:<a href='064list.mu.html#L6'>list</a>:char/<span class="Special">raw</span> <span class="Special"><-</span> <a href='064list.mu.html#L25'>rest</a> list2 <span id="L219" class="LineNr">219 </span> ] <span id="L220" class="LineNr">220 </span> memory-should-contain [ <span id="L221" class="LineNr">221 </span> <span class="Conceal">¦</span><span class="Constant"> 10</span> <span class="Special"><-</span><span class="Constant"> 4</span> <span class="Comment"># scanning next, skipping deleted element</span> @@ -288,21 +288,21 @@ if ('onhashchange' in window) { <span id="L226" class="LineNr">226 </span> <span id="L227" class="LineNr">227 </span><span class="muScenario">scenario</span> removing-from-end-of-list [ <span id="L228" class="LineNr">228 </span> <span class="Constant">local-scope</span> -<span id="L229" class="LineNr">229 </span> list:&:list:char <span class="Special"><-</span> push<span class="Constant"> 3</span>,<span class="Constant"> 0</span> -<span id="L230" class="LineNr">230 </span> list <span class="Special"><-</span> push<span class="Constant"> 4</span>, list -<span id="L231" class="LineNr">231 </span> list <span class="Special"><-</span> push<span class="Constant"> 5</span>, list +<span id="L229" class="LineNr">229 </span> <a href='064list.mu.html#L6'>list</a>:&:<a href='064list.mu.html#L6'>list</a>:char <span class="Special"><-</span> push<span class="Constant"> 3</span>,<span class="Constant"> 0</span> +<span id="L230" class="LineNr">230 </span> <a href='064list.mu.html#L6'>list</a> <span class="Special"><-</span> push<span class="Constant"> 4</span>, <a href='064list.mu.html#L6'>list</a> +<span id="L231" class="LineNr">231 </span> <a href='064list.mu.html#L6'>list</a> <span class="Special"><-</span> push<span class="Constant"> 5</span>, <a href='064list.mu.html#L6'>list</a> <span id="L232" class="LineNr">232 </span> run [ <span id="L233" class="LineNr">233 </span> <span class="Conceal">¦</span> <span class="Comment"># delete last element</span> -<span id="L234" class="LineNr">234 </span> <span class="Conceal">¦</span> list2:&:list:char <span class="Special"><-</span> <a href='064list.mu.html#L25'>rest</a> list +<span id="L234" class="LineNr">234 </span> <span class="Conceal">¦</span> list2:&:<a href='064list.mu.html#L6'>list</a>:char <span class="Special"><-</span> <a href='064list.mu.html#L25'>rest</a> <a href='064list.mu.html#L6'>list</a> <span id="L235" class="LineNr">235 </span> <span class="Conceal">¦</span> list2 <span class="Special"><-</span> <a href='064list.mu.html#L25'>rest</a> list2 -<span id="L236" class="LineNr">236 </span> <span class="Conceal">¦</span> list <span class="Special"><-</span> remove list2, list +<span id="L236" class="LineNr">236 </span> <span class="Conceal">¦</span> <a href='064list.mu.html#L6'>list</a> <span class="Special"><-</span> remove list2, <a href='064list.mu.html#L6'>list</a> <span id="L237" class="LineNr">237 </span> <span class="Conceal">¦</span> 10:bool/<span class="Special">raw</span> <span class="Special"><-</span> equal list2,<span class="Constant"> 0</span> <span id="L238" class="LineNr">238 </span> <span class="Conceal">¦</span> <span class="Comment"># check structure like before</span> -<span id="L239" class="LineNr">239 </span> <span class="Conceal">¦</span> list2 <span class="Special"><-</span> copy list +<span id="L239" class="LineNr">239 </span> <span class="Conceal">¦</span> list2 <span class="Special"><-</span> copy <a href='064list.mu.html#L6'>list</a> <span id="L240" class="LineNr">240 </span> <span class="Conceal">¦</span> 11:char/<span class="Special">raw</span> <span class="Special"><-</span> first list2 <span id="L241" class="LineNr">241 </span> <span class="Conceal">¦</span> list2 <span class="Special"><-</span> <a href='064list.mu.html#L25'>rest</a> list2 <span id="L242" class="LineNr">242 </span> <span class="Conceal">¦</span> 12:char/<span class="Special">raw</span> <span class="Special"><-</span> first list2 -<span id="L243" class="LineNr">243 </span> <span class="Conceal">¦</span> 20:&:list:char/<span class="Special">raw</span> <span class="Special"><-</span> <a href='064list.mu.html#L25'>rest</a> list2 +<span id="L243" class="LineNr">243 </span> <span class="Conceal">¦</span> 20:&:<a href='064list.mu.html#L6'>list</a>:char/<span class="Special">raw</span> <span class="Special"><-</span> <a href='064list.mu.html#L25'>rest</a> list2 <span id="L244" class="LineNr">244 </span> ] <span id="L245" class="LineNr">245 </span> memory-should-contain [ <span id="L246" class="LineNr">246 </span> <span class="Conceal">¦</span><span class="Constant"> 10</span> <span class="Special"><-</span><span class="Constant"> 0</span> <span class="Comment"># remove returned non-null</span> @@ -314,10 +314,10 @@ if ('onhashchange' in window) { <span id="L252" class="LineNr">252 </span> <span id="L253" class="LineNr">253 </span><span class="muScenario">scenario</span> removing-from-singleton-list [ <span id="L254" class="LineNr">254 </span> <span class="Constant">local-scope</span> -<span id="L255" class="LineNr">255 </span> list:&:list:char <span class="Special"><-</span> push<span class="Constant"> 3</span>,<span class="Constant"> 0</span> +<span id="L255" class="LineNr">255 </span> <a href='064list.mu.html#L6'>list</a>:&:<a href='064list.mu.html#L6'>list</a>:char <span class="Special"><-</span> push<span class="Constant"> 3</span>,<span class="Constant"> 0</span> <span id="L256" class="LineNr">256 </span> run [ -<span id="L257" class="LineNr">257 </span> <span class="Conceal">¦</span> list <span class="Special"><-</span> remove list, list -<span id="L258" class="LineNr">258 </span> <span class="Conceal">¦</span> 1:num/<span class="Special">raw</span> <span class="Special"><-</span> copy list +<span id="L257" class="LineNr">257 </span> <span class="Conceal">¦</span> <a href='064list.mu.html#L6'>list</a> <span class="Special"><-</span> remove <a href='064list.mu.html#L6'>list</a>, <a href='064list.mu.html#L6'>list</a> +<span id="L258" class="LineNr">258 </span> <span class="Conceal">¦</span> 1:num/<span class="Special">raw</span> <span class="Special"><-</span> copy <a href='064list.mu.html#L6'>list</a> <span id="L259" class="LineNr">259 </span> ] <span id="L260" class="LineNr">260 </span> memory-should-contain [ <span id="L261" class="LineNr">261 </span> <span class="Conceal">¦</span><span class="Constant"> 1</span> <span class="Special"><-</span><span class="Constant"> 0</span> <span class="Comment"># back to an empty list</span> @@ -326,50 +326,50 @@ if ('onhashchange' in window) { <span id="L264" class="LineNr">264 </span> <span id="L265" class="LineNr">265 </span><span class="Comment"># reverse the elements of a list</span> <span id="L266" class="LineNr">266 </span><span class="Comment"># (contributed by Caleb Couch)</span> -<span id="L267" class="LineNr">267 </span><span class="muRecipe">def</span> reverse list:&:list:_elem temp:&:list:_elem/contained-in:result<span class="muRecipe"> -> </span>result:&:list:_elem [ +<span id="L267" class="LineNr">267 </span><span class="muRecipe">def</span> reverse <a href='064list.mu.html#L6'>list</a>:&:<a href='064list.mu.html#L6'>list</a>:_elem temp:&:<a href='064list.mu.html#L6'>list</a>:_elem/contained-in:result<span class="muRecipe"> -> </span>result:&:<a href='064list.mu.html#L6'>list</a>:_elem [ <span id="L268" class="LineNr">268 </span> <span class="Constant">local-scope</span> <span id="L269" class="LineNr">269 </span> <span class="Constant">load-ingredients</span> -<span id="L270" class="LineNr">270 </span> <span class="muControl">return-unless</span> list, temp -<span id="L271" class="LineNr">271 </span> object:_elem <span class="Special"><-</span> first, list -<span id="L272" class="LineNr">272 </span> list <span class="Special"><-</span> <a href='064list.mu.html#L25'>rest</a> list +<span id="L270" class="LineNr">270 </span> <span class="muControl">return-unless</span> <a href='064list.mu.html#L6'>list</a>, temp +<span id="L271" class="LineNr">271 </span> object:_elem <span class="Special"><-</span> first, <a href='064list.mu.html#L6'>list</a> +<span id="L272" class="LineNr">272 </span> <a href='064list.mu.html#L6'>list</a> <span class="Special"><-</span> <a href='064list.mu.html#L25'>rest</a> <a href='064list.mu.html#L6'>list</a> <span id="L273" class="LineNr">273 </span> temp <span class="Special"><-</span> push object, temp -<span id="L274" class="LineNr">274 </span> result <span class="Special"><-</span> reverse list, temp +<span id="L274" class="LineNr">274 </span> result <span class="Special"><-</span> reverse <a href='064list.mu.html#L6'>list</a>, temp <span id="L275" class="LineNr">275 </span>] <span id="L276" class="LineNr">276 </span> <span id="L277" class="LineNr">277 </span><span class="muScenario">scenario</span> reverse-list [ <span id="L278" class="LineNr">278 </span> <span class="Constant">local-scope</span> -<span id="L279" class="LineNr">279 </span> list:&:list:number <span class="Special"><-</span> push<span class="Constant"> 1</span>,<span class="Constant"> 0</span> -<span id="L280" class="LineNr">280 </span> list <span class="Special"><-</span> push<span class="Constant"> 2</span>, list -<span id="L281" class="LineNr">281 </span> list <span class="Special"><-</span> push<span class="Constant"> 3</span>, list +<span id="L279" class="LineNr">279 </span> <a href='064list.mu.html#L6'>list</a>:&:<a href='064list.mu.html#L6'>list</a>:number <span class="Special"><-</span> push<span class="Constant"> 1</span>,<span class="Constant"> 0</span> +<span id="L280" class="LineNr">280 </span> <a href='064list.mu.html#L6'>list</a> <span class="Special"><-</span> push<span class="Constant"> 2</span>, <a href='064list.mu.html#L6'>list</a> +<span id="L281" class="LineNr">281 </span> <a href='064list.mu.html#L6'>list</a> <span class="Special"><-</span> push<span class="Constant"> 3</span>, <a href='064list.mu.html#L6'>list</a> <span id="L282" class="LineNr">282 </span> run [ -<span id="L283" class="LineNr">283 </span> <span class="Conceal">¦</span> stash <span class="Constant">[list:]</span>, list -<span id="L284" class="LineNr">284 </span> <span class="Conceal">¦</span> list <span class="Special"><-</span> reverse list -<span id="L285" class="LineNr">285 </span> <span class="Conceal">¦</span> stash <span class="Constant">[reversed:]</span>, list +<span id="L283" class="LineNr">283 </span> <span class="Conceal">¦</span> stash <span class="Constant">[list:]</span>, <a href='064list.mu.html#L6'>list</a> +<span id="L284" class="LineNr">284 </span> <span class="Conceal">¦</span> <a href='064list.mu.html#L6'>list</a> <span class="Special"><-</span> reverse <a href='064list.mu.html#L6'>list</a> +<span id="L285" class="LineNr">285 </span> <span class="Conceal">¦</span> stash <span class="Constant">[reversed:]</span>, <a href='064list.mu.html#L6'>list</a> <span id="L286" class="LineNr">286 </span> ] <span id="L287" class="LineNr">287 </span> trace-should-contain [ -<span id="L288" class="LineNr">288 </span> <span class="Conceal">¦</span> app: list:<span class="Constant"> 3</span><span class="muRecipe"> -> </span>2<span class="muRecipe"> -> </span>1 +<span id="L288" class="LineNr">288 </span> <span class="Conceal">¦</span> app: <a href='064list.mu.html#L6'>list</a>:<span class="Constant"> 3</span><span class="muRecipe"> -> </span>2<span class="muRecipe"> -> </span>1 <span id="L289" class="LineNr">289 </span> <span class="Conceal">¦</span> app: reversed:<span class="Constant"> 1</span><span class="muRecipe"> -> </span>2<span class="muRecipe"> -> </span>3 <span id="L290" class="LineNr">290 </span> ] <span id="L291" class="LineNr">291 </span>] <span id="L292" class="LineNr">292 </span> -<span id="L293" class="LineNr">293 </span><span class="muRecipe">def</span> to-text in:&:list:_elem<span class="muRecipe"> -> </span>result:text [ +<span id="L293" class="LineNr">293 </span><span class="muRecipe">def</span> to-text in:&:<a href='064list.mu.html#L6'>list</a>:_elem<span class="muRecipe"> -> </span>result:text [ <span id="L294" class="LineNr">294 </span> <span class="Constant">local-scope</span> <span id="L295" class="LineNr">295 </span> <span class="Constant">load-ingredients</span> -<span id="L296" class="LineNr">296 </span> buf:&:buffer:char <span class="Special"><-</span> <a href='061text.mu.html#L131'>new-buffer</a><span class="Constant"> 80</span> +<span id="L296" class="LineNr">296 </span> buf:&:<a href='061text.mu.html#L126'>buffer</a>:char <span class="Special"><-</span> <a href='061text.mu.html#L131'>new-buffer</a><span class="Constant"> 80</span> <span id="L297" class="LineNr">297 </span> buf <span class="Special"><-</span> <a href='064list.mu.html#L310'>to-buffer</a> in, buf <span id="L298" class="LineNr">298 </span> result <span class="Special"><-</span> <a href='061text.mu.html#L328'>buffer-to-array</a> buf <span id="L299" class="LineNr">299 </span>] <span id="L300" class="LineNr">300 </span> <span id="L301" class="LineNr">301 </span><span class="Comment"># variant of 'to-text' which stops printing after a few elements (and so is robust to cycles)</span> -<span id="L302" class="LineNr">302 </span><span class="muRecipe">def</span> to-text-line in:&:list:_elem<span class="muRecipe"> -> </span>result:text [ +<span id="L302" class="LineNr">302 </span><span class="muRecipe">def</span> to-text-line in:&:<a href='064list.mu.html#L6'>list</a>:_elem<span class="muRecipe"> -> </span>result:text [ <span id="L303" class="LineNr">303 </span> <span class="Constant">local-scope</span> <span id="L304" class="LineNr">304 </span> <span class="Constant">load-ingredients</span> -<span id="L305" class="LineNr">305 </span> buf:&:buffer:char <span class="Special"><-</span> <a href='061text.mu.html#L131'>new-buffer</a><span class="Constant"> 80</span> +<span id="L305" class="LineNr">305 </span> buf:&:<a href='061text.mu.html#L126'>buffer</a>:char <span class="Special"><-</span> <a href='061text.mu.html#L131'>new-buffer</a><span class="Constant"> 80</span> <span id="L306" class="LineNr">306 </span> buf <span class="Special"><-</span> <a href='064list.mu.html#L310'>to-buffer</a> in, buf,<span class="Constant"> 6</span> <span class="Comment"># max elements to display</span> <span id="L307" class="LineNr">307 </span> result <span class="Special"><-</span> <a href='061text.mu.html#L328'>buffer-to-array</a> buf <span id="L308" class="LineNr">308 </span>] <span id="L309" class="LineNr">309 </span> -<span id="L310" class="LineNr">310 </span><span class="muRecipe">def</span> <a href='064list.mu.html#L310'>to-buffer</a> in:&:list:_elem, buf:&:buffer:char<span class="muRecipe"> -> </span>buf:&:buffer:char [ +<span id="L310" class="LineNr">310 </span><span class="muRecipe">def</span> <a href='064list.mu.html#L310'>to-buffer</a> in:&:<a href='064list.mu.html#L6'>list</a>:_elem, buf:&:<a href='061text.mu.html#L126'>buffer</a>:char<span class="muRecipe"> -> </span>buf:&:<a href='061text.mu.html#L126'>buffer</a>:char [ <span id="L311" class="LineNr">311 </span> <span class="Constant">local-scope</span> <span id="L312" class="LineNr">312 </span> <span class="Constant">load-ingredients</span> <span id="L313" class="LineNr">313 </span> <span class="Delimiter">{</span> @@ -381,7 +381,7 @@ if ('onhashchange' in window) { <span id="L319" class="LineNr">319 </span> val:_elem <span class="Special"><-</span> get *in, <span class="Constant">value:offset</span> <span id="L320" class="LineNr">320 </span> buf <span class="Special"><-</span> append buf, val <span id="L321" class="LineNr">321 </span> <span class="Comment"># now prepare next</span> -<span id="L322" class="LineNr">322 </span> <a href='065duplex_list.mu.html#L29'>next</a>:&:list:_elem <span class="Special"><-</span> <a href='064list.mu.html#L25'>rest</a> in +<span id="L322" class="LineNr">322 </span> <a href='065duplex_list.mu.html#L29'>next</a>:&:<a href='064list.mu.html#L6'>list</a>:_elem <span class="Special"><-</span> <a href='064list.mu.html#L25'>rest</a> in <span id="L323" class="LineNr">323 </span> nextn:num <span class="Special"><-</span> copy <a href='065duplex_list.mu.html#L29'>next</a> <span id="L324" class="LineNr">324 </span> <span class="muControl">return-unless</span> <a href='065duplex_list.mu.html#L29'>next</a> <span id="L325" class="LineNr">325 </span> buf <span class="Special"><-</span> append buf, <span class="Constant">[ -> ]</span> @@ -406,7 +406,7 @@ if ('onhashchange' in window) { <span id="L344" class="LineNr">344 </span> <span id="L345" class="LineNr">345 </span><span class="muScenario">scenario</span> stash-empty-list [ <span id="L346" class="LineNr">346 </span> <span class="Constant">local-scope</span> -<span id="L347" class="LineNr">347 </span> x:&:list:num <span class="Special"><-</span> copy<span class="Constant"> 0</span> +<span id="L347" class="LineNr">347 </span> x:&:<a href='064list.mu.html#L6'>list</a>:num <span class="Special"><-</span> copy<span class="Constant"> 0</span> <span id="L348" class="LineNr">348 </span> run [ <span id="L349" class="LineNr">349 </span> <span class="Conceal">¦</span> stash x <span id="L350" class="LineNr">350 </span> ] diff --git a/html/065duplex_list.mu.html b/html/065duplex_list.mu.html index fedcd670..55bb4707 100644 --- a/html/065duplex_list.mu.html +++ b/html/065duplex_list.mu.html @@ -62,17 +62,17 @@ if ('onhashchange' in window) { <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment"># A doubly linked list permits bidirectional traversal.</span> <span id="L2" class="LineNr"> 2 </span> -<span id="L3" class="LineNr"> 3 </span><span class="muData">container</span> duplex-list:_elem [ +<span id="L3" class="LineNr"> 3 </span><span class="muData">container</span> <a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem [ <span id="L4" class="LineNr"> 4 </span> value:_elem -<span id="L5" class="LineNr"> 5 </span> <a href='065duplex_list.mu.html#L29'>next</a>:&:duplex-list:_elem -<span id="L6" class="LineNr"> 6 </span> <a href='065duplex_list.mu.html#L36'>prev</a>:&:duplex-list:_elem +<span id="L5" class="LineNr"> 5 </span> <a href='065duplex_list.mu.html#L29'>next</a>:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem +<span id="L6" class="LineNr"> 6 </span> <a href='065duplex_list.mu.html#L36'>prev</a>:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem <span id="L7" class="LineNr"> 7 </span>] <span id="L8" class="LineNr"> 8 </span> <span id="L9" class="LineNr"> 9 </span><span class="Comment"># should I say in/contained-in:result, allow ingredients to refer to products?</span> -<span id="L10" class="LineNr"> 10 </span><span class="muRecipe">def</span> push x:_elem, in:&:duplex-list:_elem<span class="muRecipe"> -> </span>in:&:duplex-list:_elem [ +<span id="L10" class="LineNr"> 10 </span><span class="muRecipe">def</span> push x:_elem, in:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem<span class="muRecipe"> -> </span>in:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem [ <span id="L11" class="LineNr"> 11 </span> <span class="Constant">local-scope</span> <span id="L12" class="LineNr"> 12 </span> <span class="Constant">load-ingredients</span> -<span id="L13" class="LineNr"> 13 </span> result:&:duplex-list:_elem <span class="Special"><-</span> new <span class="Delimiter">{</span>(duplex-list _elem): type<span class="Delimiter">}</span> +<span id="L13" class="LineNr"> 13 </span> result:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem <span class="Special"><-</span> new <span class="Delimiter">{</span>(duplex-list _elem): type<span class="Delimiter">}</span> <span id="L14" class="LineNr"> 14 </span> *result <span class="Special"><-</span> merge x, in,<span class="Constant"> 0</span> <span id="L15" class="LineNr"> 15 </span> <span class="Delimiter">{</span> <span id="L16" class="LineNr"> 16 </span> <span class="Conceal">¦</span> <span class="muControl">break-unless</span> in @@ -81,21 +81,21 @@ if ('onhashchange' in window) { <span id="L19" class="LineNr"> 19 </span> <span class="muControl">return</span> result <span class="Comment"># needed explicitly because we need to replace 'in' with 'result'</span> <span id="L20" class="LineNr"> 20 </span>] <span id="L21" class="LineNr"> 21 </span> -<span id="L22" class="LineNr"> 22 </span><span class="muRecipe">def</span> first in:&:duplex-list:_elem<span class="muRecipe"> -> </span>result:_elem [ +<span id="L22" class="LineNr"> 22 </span><span class="muRecipe">def</span> first in:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem<span class="muRecipe"> -> </span>result:_elem [ <span id="L23" class="LineNr"> 23 </span> <span class="Constant">local-scope</span> <span id="L24" class="LineNr"> 24 </span> <span class="Constant">load-ingredients</span> <span id="L25" class="LineNr"> 25 </span> <span class="muControl">return-unless</span> in,<span class="Constant"> 0</span> <span id="L26" class="LineNr"> 26 </span> result <span class="Special"><-</span> get *in, <span class="Constant">value:offset</span> <span id="L27" class="LineNr"> 27 </span>] <span id="L28" class="LineNr"> 28 </span> -<span id="L29" class="LineNr"> 29 </span><span class="muRecipe">def</span> <a href='065duplex_list.mu.html#L29'>next</a> in:&:duplex-list:_elem<span class="muRecipe"> -> </span>result:&:duplex-list:_elem/contained-in:in [ +<span id="L29" class="LineNr"> 29 </span><span class="muRecipe">def</span> <a href='065duplex_list.mu.html#L29'>next</a> in:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem<span class="muRecipe"> -> </span>result:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem/contained-in:in [ <span id="L30" class="LineNr"> 30 </span> <span class="Constant">local-scope</span> <span id="L31" class="LineNr"> 31 </span> <span class="Constant">load-ingredients</span> <span id="L32" class="LineNr"> 32 </span> <span class="muControl">return-unless</span> in,<span class="Constant"> 0</span> <span id="L33" class="LineNr"> 33 </span> result <span class="Special"><-</span> get *in, <span class="Constant"><a href='065duplex_list.mu.html#L29'>next</a>:offset</span> <span id="L34" class="LineNr"> 34 </span>] <span id="L35" class="LineNr"> 35 </span> -<span id="L36" class="LineNr"> 36 </span><span class="muRecipe">def</span> <a href='065duplex_list.mu.html#L36'>prev</a> in:&:duplex-list:_elem<span class="muRecipe"> -> </span>result:&:duplex-list:_elem/contained-in:in [ +<span id="L36" class="LineNr"> 36 </span><span class="muRecipe">def</span> <a href='065duplex_list.mu.html#L36'>prev</a> in:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem<span class="muRecipe"> -> </span>result:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem/contained-in:in [ <span id="L37" class="LineNr"> 37 </span> <span class="Constant">local-scope</span> <span id="L38" class="LineNr"> 38 </span> <span class="Constant">load-ingredients</span> <span id="L39" class="LineNr"> 39 </span> <span class="muControl">return-unless</span> in,<span class="Constant"> 0</span> @@ -109,24 +109,24 @@ if ('onhashchange' in window) { <span id="L47" class="LineNr"> 47 </span> <span class="Conceal">¦</span> <span class="Comment"># reserve locations 0-9 to check for missing null check</span> <span id="L48" class="LineNr"> 48 </span> <span class="Conceal">¦</span> 10:num/<span class="Special">raw</span> <span class="Special"><-</span> copy<span class="Constant"> 34</span> <span id="L49" class="LineNr"> 49 </span> <span class="Conceal">¦</span> 11:num/<span class="Special">raw</span> <span class="Special"><-</span> copy<span class="Constant"> 35</span> -<span id="L50" class="LineNr"> 50 </span> <span class="Conceal">¦</span> list:&:duplex-list:char <span class="Special"><-</span> push<span class="Constant"> 3</span>,<span class="Constant"> 0</span> -<span id="L51" class="LineNr"> 51 </span> <span class="Conceal">¦</span> list <span class="Special"><-</span> push<span class="Constant"> 4</span>, list -<span id="L52" class="LineNr"> 52 </span> <span class="Conceal">¦</span> list <span class="Special"><-</span> push<span class="Constant"> 5</span>, list -<span id="L53" class="LineNr"> 53 </span> <span class="Conceal">¦</span> list2:&:duplex-list:char <span class="Special"><-</span> copy list +<span id="L50" class="LineNr"> 50 </span> <span class="Conceal">¦</span> <a href='064list.mu.html#L6'>list</a>:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> push<span class="Constant"> 3</span>,<span class="Constant"> 0</span> +<span id="L51" class="LineNr"> 51 </span> <span class="Conceal">¦</span> <a href='064list.mu.html#L6'>list</a> <span class="Special"><-</span> push<span class="Constant"> 4</span>, <a href='064list.mu.html#L6'>list</a> +<span id="L52" class="LineNr"> 52 </span> <span class="Conceal">¦</span> <a href='064list.mu.html#L6'>list</a> <span class="Special"><-</span> push<span class="Constant"> 5</span>, <a href='064list.mu.html#L6'>list</a> +<span id="L53" class="LineNr"> 53 </span> <span class="Conceal">¦</span> list2:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> copy <a href='064list.mu.html#L6'>list</a> <span id="L54" class="LineNr"> 54 </span> <span class="Conceal">¦</span> 20:char/<span class="Special">raw</span> <span class="Special"><-</span> first list2 <span id="L55" class="LineNr"> 55 </span> <span class="Conceal">¦</span> list2 <span class="Special"><-</span> <a href='065duplex_list.mu.html#L29'>next</a> list2 <span id="L56" class="LineNr"> 56 </span> <span class="Conceal">¦</span> 21:char/<span class="Special">raw</span> <span class="Special"><-</span> first list2 <span id="L57" class="LineNr"> 57 </span> <span class="Conceal">¦</span> list2 <span class="Special"><-</span> <a href='065duplex_list.mu.html#L29'>next</a> list2 <span id="L58" class="LineNr"> 58 </span> <span class="Conceal">¦</span> 22:char/<span class="Special">raw</span> <span class="Special"><-</span> first list2 -<span id="L59" class="LineNr"> 59 </span> <span class="Conceal">¦</span> 30:&:duplex-list:char/<span class="Special">raw</span> <span class="Special"><-</span> <a href='065duplex_list.mu.html#L29'>next</a> list2 -<span id="L60" class="LineNr"> 60 </span> <span class="Conceal">¦</span> 31:char/<span class="Special">raw</span> <span class="Special"><-</span> first 30:&:duplex-list:char/<span class="Special">raw</span> -<span id="L61" class="LineNr"> 61 </span> <span class="Conceal">¦</span> 32:&:duplex-list:char/<span class="Special">raw</span> <span class="Special"><-</span> <a href='065duplex_list.mu.html#L29'>next</a> 30:&:duplex-list:char/<span class="Special">raw</span> -<span id="L62" class="LineNr"> 62 </span> <span class="Conceal">¦</span> 33:&:duplex-list:char/<span class="Special">raw</span> <span class="Special"><-</span> <a href='065duplex_list.mu.html#L36'>prev</a> 30:&:duplex-list:char/<span class="Special">raw</span> +<span id="L59" class="LineNr"> 59 </span> <span class="Conceal">¦</span> 30:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:char/<span class="Special">raw</span> <span class="Special"><-</span> <a href='065duplex_list.mu.html#L29'>next</a> list2 +<span id="L60" class="LineNr"> 60 </span> <span class="Conceal">¦</span> 31:char/<span class="Special">raw</span> <span class="Special"><-</span> first 30:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:char/<span class="Special">raw</span> +<span id="L61" class="LineNr"> 61 </span> <span class="Conceal">¦</span> 32:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:char/<span class="Special">raw</span> <span class="Special"><-</span> <a href='065duplex_list.mu.html#L29'>next</a> 30:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:char/<span class="Special">raw</span> +<span id="L62" class="LineNr"> 62 </span> <span class="Conceal">¦</span> 33:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:char/<span class="Special">raw</span> <span class="Special"><-</span> <a href='065duplex_list.mu.html#L36'>prev</a> 30:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:char/<span class="Special">raw</span> <span id="L63" class="LineNr"> 63 </span> <span class="Conceal">¦</span> list2 <span class="Special"><-</span> <a href='065duplex_list.mu.html#L36'>prev</a> list2 <span id="L64" class="LineNr"> 64 </span> <span class="Conceal">¦</span> 40:char/<span class="Special">raw</span> <span class="Special"><-</span> first list2 <span id="L65" class="LineNr"> 65 </span> <span class="Conceal">¦</span> list2 <span class="Special"><-</span> <a href='065duplex_list.mu.html#L36'>prev</a> list2 <span id="L66" class="LineNr"> 66 </span> <span class="Conceal">¦</span> 41:char/<span class="Special">raw</span> <span class="Special"><-</span> first list2 -<span id="L67" class="LineNr"> 67 </span> <span class="Conceal">¦</span> 50:bool/<span class="Special">raw</span> <span class="Special"><-</span> equal list, list2 +<span id="L67" class="LineNr"> 67 </span> <span class="Conceal">¦</span> 50:bool/<span class="Special">raw</span> <span class="Special"><-</span> equal <a href='064list.mu.html#L6'>list</a>, list2 <span id="L68" class="LineNr"> 68 </span> ] <span id="L69" class="LineNr"> 69 </span> memory-should-contain [ <span id="L70" class="LineNr"> 70 </span> <span class="Conceal">¦</span><span class="Constant"> 0</span> <span class="Special"><-</span><span class="Constant"> 0</span> <span class="Comment"># no modifications to null pointers</span> @@ -145,7 +145,7 @@ if ('onhashchange' in window) { <span id="L83" class="LineNr"> 83 </span> ] <span id="L84" class="LineNr"> 84 </span>] <span id="L85" class="LineNr"> 85 </span> -<span id="L86" class="LineNr"> 86 </span><span class="muRecipe">def</span> length l:&:duplex-list:_elem<span class="muRecipe"> -> </span>result:num [ +<span id="L86" class="LineNr"> 86 </span><span class="muRecipe">def</span> length l:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem<span class="muRecipe"> -> </span>result:num [ <span id="L87" class="LineNr"> 87 </span> <span class="Constant">local-scope</span> <span id="L88" class="LineNr"> 88 </span> <span class="Constant">load-ingredients</span> <span id="L89" class="LineNr"> 89 </span> result <span class="Special"><-</span> copy<span class="Constant"> 0</span> @@ -158,13 +158,13 @@ if ('onhashchange' in window) { <span id="L96" class="LineNr"> 96 </span>] <span id="L97" class="LineNr"> 97 </span> <span id="L98" class="LineNr"> 98 </span><span class="Comment"># insert 'x' after 'in'</span> -<span id="L99" class="LineNr"> 99 </span><span class="muRecipe">def</span> insert x:_elem, in:&:duplex-list:_elem<span class="muRecipe"> -> </span>in:&:duplex-list:_elem [ +<span id="L99" class="LineNr"> 99 </span><span class="muRecipe">def</span> insert x:_elem, in:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem<span class="muRecipe"> -> </span>in:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem [ <span id="L100" class="LineNr">100 </span> <span class="Constant">local-scope</span> <span id="L101" class="LineNr">101 </span> <span class="Constant">load-ingredients</span> -<span id="L102" class="LineNr">102 </span> new-node:&:duplex-list:_elem <span class="Special"><-</span> new <span class="Delimiter">{</span>(duplex-list _elem): type<span class="Delimiter">}</span> +<span id="L102" class="LineNr">102 </span> new-node:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem <span class="Special"><-</span> new <span class="Delimiter">{</span>(duplex-list _elem): type<span class="Delimiter">}</span> <span id="L103" class="LineNr">103 </span> *new-node <span class="Special"><-</span> put *new-node, <span class="Constant">value:offset</span>, x <span id="L104" class="LineNr">104 </span> <span class="Comment"># save old next before changing it</span> -<span id="L105" class="LineNr">105 </span> next-node:&:duplex-list:_elem <span class="Special"><-</span> get *in, <span class="Constant"><a href='065duplex_list.mu.html#L29'>next</a>:offset</span> +<span id="L105" class="LineNr">105 </span> next-node:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem <span class="Special"><-</span> get *in, <span class="Constant"><a href='065duplex_list.mu.html#L29'>next</a>:offset</span> <span id="L106" class="LineNr">106 </span> *in <span class="Special"><-</span> put *in, <span class="Constant"><a href='065duplex_list.mu.html#L29'>next</a>:offset</span>, new-node <span id="L107" class="LineNr">107 </span> *new-node <span class="Special"><-</span> put *new-node, <span class="Constant"><a href='065duplex_list.mu.html#L36'>prev</a>:offset</span>, in <span id="L108" class="LineNr">108 </span> *new-node <span class="Special"><-</span> put *new-node, <span class="Constant"><a href='065duplex_list.mu.html#L29'>next</a>:offset</span>, next-node @@ -174,14 +174,14 @@ if ('onhashchange' in window) { <span id="L112" class="LineNr">112 </span> <span id="L113" class="LineNr">113 </span><span class="muScenario">scenario</span> inserting-into-duplex-list [ <span id="L114" class="LineNr">114 </span> <span class="Constant">local-scope</span> -<span id="L115" class="LineNr">115 </span> list:&:duplex-list:char <span class="Special"><-</span> push<span class="Constant"> 3</span>,<span class="Constant"> 0</span> -<span id="L116" class="LineNr">116 </span> list <span class="Special"><-</span> push<span class="Constant"> 4</span>, list -<span id="L117" class="LineNr">117 </span> list <span class="Special"><-</span> push<span class="Constant"> 5</span>, list +<span id="L115" class="LineNr">115 </span> <a href='064list.mu.html#L6'>list</a>:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> push<span class="Constant"> 3</span>,<span class="Constant"> 0</span> +<span id="L116" class="LineNr">116 </span> <a href='064list.mu.html#L6'>list</a> <span class="Special"><-</span> push<span class="Constant"> 4</span>, <a href='064list.mu.html#L6'>list</a> +<span id="L117" class="LineNr">117 </span> <a href='064list.mu.html#L6'>list</a> <span class="Special"><-</span> push<span class="Constant"> 5</span>, <a href='064list.mu.html#L6'>list</a> <span id="L118" class="LineNr">118 </span> run [ -<span id="L119" class="LineNr">119 </span> <span class="Conceal">¦</span> list2:&:duplex-list:char <span class="Special"><-</span> <a href='065duplex_list.mu.html#L29'>next</a> list <span class="Comment"># inside list</span> +<span id="L119" class="LineNr">119 </span> <span class="Conceal">¦</span> list2:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> <a href='065duplex_list.mu.html#L29'>next</a> <a href='064list.mu.html#L6'>list</a> <span class="Comment"># inside list</span> <span id="L120" class="LineNr">120 </span> <span class="Conceal">¦</span> list2 <span class="Special"><-</span> insert<span class="Constant"> 6</span>, list2 <span id="L121" class="LineNr">121 </span> <span class="Conceal">¦</span> <span class="Comment"># check structure like before</span> -<span id="L122" class="LineNr">122 </span> <span class="Conceal">¦</span> list2 <span class="Special"><-</span> copy list +<span id="L122" class="LineNr">122 </span> <span class="Conceal">¦</span> list2 <span class="Special"><-</span> copy <a href='064list.mu.html#L6'>list</a> <span id="L123" class="LineNr">123 </span> <span class="Conceal">¦</span> 10:char/<span class="Special">raw</span> <span class="Special"><-</span> first list2 <span id="L124" class="LineNr">124 </span> <span class="Conceal">¦</span> list2 <span class="Special"><-</span> <a href='065duplex_list.mu.html#L29'>next</a> list2 <span id="L125" class="LineNr">125 </span> <span class="Conceal">¦</span> 11:char/<span class="Special">raw</span> <span class="Special"><-</span> first list2 @@ -195,7 +195,7 @@ if ('onhashchange' in window) { <span id="L133" class="LineNr">133 </span> <span class="Conceal">¦</span> 21:char/<span class="Special">raw</span> <span class="Special"><-</span> first list2 <span id="L134" class="LineNr">134 </span> <span class="Conceal">¦</span> list2 <span class="Special"><-</span> <a href='065duplex_list.mu.html#L36'>prev</a> list2 <span id="L135" class="LineNr">135 </span> <span class="Conceal">¦</span> 22:char/<span class="Special">raw</span> <span class="Special"><-</span> first list2 -<span id="L136" class="LineNr">136 </span> <span class="Conceal">¦</span> 30:bool/<span class="Special">raw</span> <span class="Special"><-</span> equal list, list2 +<span id="L136" class="LineNr">136 </span> <span class="Conceal">¦</span> 30:bool/<span class="Special">raw</span> <span class="Special"><-</span> equal <a href='064list.mu.html#L6'>list</a>, list2 <span id="L137" class="LineNr">137 </span> ] <span id="L138" class="LineNr">138 </span> memory-should-contain [ <span id="L139" class="LineNr">139 </span> <span class="Conceal">¦</span><span class="Constant"> 10</span> <span class="Special"><-</span><span class="Constant"> 5</span> <span class="Comment"># scanning next</span> @@ -211,15 +211,15 @@ if ('onhashchange' in window) { <span id="L149" class="LineNr">149 </span> <span id="L150" class="LineNr">150 </span><span class="muScenario">scenario</span> inserting-at-end-of-duplex-list [ <span id="L151" class="LineNr">151 </span> <span class="Constant">local-scope</span> -<span id="L152" class="LineNr">152 </span> list:&:duplex-list:char <span class="Special"><-</span> push<span class="Constant"> 3</span>,<span class="Constant"> 0</span> -<span id="L153" class="LineNr">153 </span> list <span class="Special"><-</span> push<span class="Constant"> 4</span>, list -<span id="L154" class="LineNr">154 </span> list <span class="Special"><-</span> push<span class="Constant"> 5</span>, list +<span id="L152" class="LineNr">152 </span> <a href='064list.mu.html#L6'>list</a>:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> push<span class="Constant"> 3</span>,<span class="Constant"> 0</span> +<span id="L153" class="LineNr">153 </span> <a href='064list.mu.html#L6'>list</a> <span class="Special"><-</span> push<span class="Constant"> 4</span>, <a href='064list.mu.html#L6'>list</a> +<span id="L154" class="LineNr">154 </span> <a href='064list.mu.html#L6'>list</a> <span class="Special"><-</span> push<span class="Constant"> 5</span>, <a href='064list.mu.html#L6'>list</a> <span id="L155" class="LineNr">155 </span> run [ -<span id="L156" class="LineNr">156 </span> <span class="Conceal">¦</span> list2:&:duplex-list:char <span class="Special"><-</span> <a href='065duplex_list.mu.html#L29'>next</a> list <span class="Comment"># inside list</span> +<span id="L156" class="LineNr">156 </span> <span class="Conceal">¦</span> list2:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> <a href='065duplex_list.mu.html#L29'>next</a> <a href='064list.mu.html#L6'>list</a> <span class="Comment"># inside list</span> <span id="L157" class="LineNr">157 </span> <span class="Conceal">¦</span> list2 <span class="Special"><-</span> <a href='065duplex_list.mu.html#L29'>next</a> list2 <span class="Comment"># now at end of list</span> <span id="L158" class="LineNr">158 </span> <span class="Conceal">¦</span> list2 <span class="Special"><-</span> insert<span class="Constant"> 6</span>, list2 <span id="L159" class="LineNr">159 </span> <span class="Conceal">¦</span> <span class="Comment"># check structure like before</span> -<span id="L160" class="LineNr">160 </span> <span class="Conceal">¦</span> list2 <span class="Special"><-</span> copy list +<span id="L160" class="LineNr">160 </span> <span class="Conceal">¦</span> list2 <span class="Special"><-</span> copy <a href='064list.mu.html#L6'>list</a> <span id="L161" class="LineNr">161 </span> <span class="Conceal">¦</span> 10:char/<span class="Special">raw</span> <span class="Special"><-</span> first list2 <span id="L162" class="LineNr">162 </span> <span class="Conceal">¦</span> list2 <span class="Special"><-</span> <a href='065duplex_list.mu.html#L29'>next</a> list2 <span id="L163" class="LineNr">163 </span> <span class="Conceal">¦</span> 11:char/<span class="Special">raw</span> <span class="Special"><-</span> first list2 @@ -233,7 +233,7 @@ if ('onhashchange' in window) { <span id="L171" class="LineNr">171 </span> <span class="Conceal">¦</span> 21:char/<span class="Special">raw</span> <span class="Special"><-</span> first list2 <span id="L172" class="LineNr">172 </span> <span class="Conceal">¦</span> list2 <span class="Special"><-</span> <a href='065duplex_list.mu.html#L36'>prev</a> list2 <span id="L173" class="LineNr">173 </span> <span class="Conceal">¦</span> 22:char/<span class="Special">raw</span> <span class="Special"><-</span> first list2 -<span id="L174" class="LineNr">174 </span> <span class="Conceal">¦</span> 30:bool/<span class="Special">raw</span> <span class="Special"><-</span> equal list, list2 +<span id="L174" class="LineNr">174 </span> <span class="Conceal">¦</span> 30:bool/<span class="Special">raw</span> <span class="Special"><-</span> equal <a href='064list.mu.html#L6'>list</a>, list2 <span id="L175" class="LineNr">175 </span> ] <span id="L176" class="LineNr">176 </span> memory-should-contain [ <span id="L177" class="LineNr">177 </span> <span class="Conceal">¦</span><span class="Constant"> 10</span> <span class="Special"><-</span><span class="Constant"> 5</span> <span class="Comment"># scanning next</span> @@ -249,13 +249,13 @@ if ('onhashchange' in window) { <span id="L187" class="LineNr">187 </span> <span id="L188" class="LineNr">188 </span><span class="muScenario">scenario</span> inserting-after-start-of-duplex-list [ <span id="L189" class="LineNr">189 </span> <span class="Constant">local-scope</span> -<span id="L190" class="LineNr">190 </span> list:&:duplex-list:char <span class="Special"><-</span> push<span class="Constant"> 3</span>,<span class="Constant"> 0</span> -<span id="L191" class="LineNr">191 </span> list <span class="Special"><-</span> push<span class="Constant"> 4</span>, list -<span id="L192" class="LineNr">192 </span> list <span class="Special"><-</span> push<span class="Constant"> 5</span>, list +<span id="L190" class="LineNr">190 </span> <a href='064list.mu.html#L6'>list</a>:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> push<span class="Constant"> 3</span>,<span class="Constant"> 0</span> +<span id="L191" class="LineNr">191 </span> <a href='064list.mu.html#L6'>list</a> <span class="Special"><-</span> push<span class="Constant"> 4</span>, <a href='064list.mu.html#L6'>list</a> +<span id="L192" class="LineNr">192 </span> <a href='064list.mu.html#L6'>list</a> <span class="Special"><-</span> push<span class="Constant"> 5</span>, <a href='064list.mu.html#L6'>list</a> <span id="L193" class="LineNr">193 </span> run [ -<span id="L194" class="LineNr">194 </span> <span class="Conceal">¦</span> list <span class="Special"><-</span> insert<span class="Constant"> 6</span>, list +<span id="L194" class="LineNr">194 </span> <span class="Conceal">¦</span> <a href='064list.mu.html#L6'>list</a> <span class="Special"><-</span> insert<span class="Constant"> 6</span>, <a href='064list.mu.html#L6'>list</a> <span id="L195" class="LineNr">195 </span> <span class="Conceal">¦</span> <span class="Comment"># check structure like before</span> -<span id="L196" class="LineNr">196 </span> <span class="Conceal">¦</span> list2:&:duplex-list:char <span class="Special"><-</span> copy list +<span id="L196" class="LineNr">196 </span> <span class="Conceal">¦</span> list2:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> copy <a href='064list.mu.html#L6'>list</a> <span id="L197" class="LineNr">197 </span> <span class="Conceal">¦</span> 10:char/<span class="Special">raw</span> <span class="Special"><-</span> first list2 <span id="L198" class="LineNr">198 </span> <span class="Conceal">¦</span> list2 <span class="Special"><-</span> <a href='065duplex_list.mu.html#L29'>next</a> list2 <span id="L199" class="LineNr">199 </span> <span class="Conceal">¦</span> 11:char/<span class="Special">raw</span> <span class="Special"><-</span> first list2 @@ -269,7 +269,7 @@ if ('onhashchange' in window) { <span id="L207" class="LineNr">207 </span> <span class="Conceal">¦</span> 21:char/<span class="Special">raw</span> <span class="Special"><-</span> first list2 <span id="L208" class="LineNr">208 </span> <span class="Conceal">¦</span> list2 <span class="Special"><-</span> <a href='065duplex_list.mu.html#L36'>prev</a> list2 <span id="L209" class="LineNr">209 </span> <span class="Conceal">¦</span> 22:char/<span class="Special">raw</span> <span class="Special"><-</span> first list2 -<span id="L210" class="LineNr">210 </span> <span class="Conceal">¦</span> 30:bool/<span class="Special">raw</span> <span class="Special"><-</span> equal list, list2 +<span id="L210" class="LineNr">210 </span> <span class="Conceal">¦</span> 30:bool/<span class="Special">raw</span> <span class="Special"><-</span> equal <a href='064list.mu.html#L6'>list</a>, list2 <span id="L211" class="LineNr">211 </span> ] <span id="L212" class="LineNr">212 </span> memory-should-contain [ <span id="L213" class="LineNr">213 </span> <span class="Conceal">¦</span><span class="Constant"> 10</span> <span class="Special"><-</span><span class="Constant"> 5</span> <span class="Comment"># scanning next</span> @@ -287,13 +287,13 @@ if ('onhashchange' in window) { <span id="L225" class="LineNr">225 </span><span class="Comment">#</span> <span id="L226" class="LineNr">226 </span><span class="Comment"># Returns null if and only if list is empty. Beware: in that case any other</span> <span id="L227" class="LineNr">227 </span><span class="Comment"># pointers to the head are now invalid.</span> -<span id="L228" class="LineNr">228 </span><span class="muRecipe">def</span> remove x:&:duplex-list:_elem/contained-in:in, in:&:duplex-list:_elem<span class="muRecipe"> -> </span>in:&:duplex-list:_elem [ +<span id="L228" class="LineNr">228 </span><span class="muRecipe">def</span> remove x:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem/contained-in:in, in:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem<span class="muRecipe"> -> </span>in:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem [ <span id="L229" class="LineNr">229 </span> <span class="Constant">local-scope</span> <span id="L230" class="LineNr">230 </span> <span class="Constant">load-ingredients</span> <span id="L231" class="LineNr">231 </span> <span class="Comment"># if 'x' is null, return</span> <span id="L232" class="LineNr">232 </span> <span class="muControl">return-unless</span> x -<span id="L233" class="LineNr">233 </span> next-node:&:duplex-list:_elem <span class="Special"><-</span> get *x, <span class="Constant"><a href='065duplex_list.mu.html#L29'>next</a>:offset</span> -<span id="L234" class="LineNr">234 </span> prev-node:&:duplex-list:_elem <span class="Special"><-</span> get *x, <span class="Constant"><a href='065duplex_list.mu.html#L36'>prev</a>:offset</span> +<span id="L233" class="LineNr">233 </span> next-node:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem <span class="Special"><-</span> get *x, <span class="Constant"><a href='065duplex_list.mu.html#L29'>next</a>:offset</span> +<span id="L234" class="LineNr">234 </span> prev-node:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem <span class="Special"><-</span> get *x, <span class="Constant"><a href='065duplex_list.mu.html#L36'>prev</a>:offset</span> <span id="L235" class="LineNr">235 </span> <span class="Comment"># null x's pointers</span> <span id="L236" class="LineNr">236 </span> *x <span class="Special"><-</span> put *x, <span class="Constant"><a href='065duplex_list.mu.html#L29'>next</a>:offset</span>,<span class="Constant"> 0</span> <span id="L237" class="LineNr">237 </span> *x <span class="Special"><-</span> put *x, <span class="Constant"><a href='065duplex_list.mu.html#L36'>prev</a>:offset</span>,<span class="Constant"> 0</span> @@ -315,22 +315,22 @@ if ('onhashchange' in window) { <span id="L253" class="LineNr">253 </span> <span id="L254" class="LineNr">254 </span><span class="muScenario">scenario</span> removing-from-duplex-list [ <span id="L255" class="LineNr">255 </span> <span class="Constant">local-scope</span> -<span id="L256" class="LineNr">256 </span> list:&:duplex-list:char <span class="Special"><-</span> push<span class="Constant"> 3</span>,<span class="Constant"> 0</span> -<span id="L257" class="LineNr">257 </span> list <span class="Special"><-</span> push<span class="Constant"> 4</span>, list -<span id="L258" class="LineNr">258 </span> list <span class="Special"><-</span> push<span class="Constant"> 5</span>, list +<span id="L256" class="LineNr">256 </span> <a href='064list.mu.html#L6'>list</a>:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> push<span class="Constant"> 3</span>,<span class="Constant"> 0</span> +<span id="L257" class="LineNr">257 </span> <a href='064list.mu.html#L6'>list</a> <span class="Special"><-</span> push<span class="Constant"> 4</span>, <a href='064list.mu.html#L6'>list</a> +<span id="L258" class="LineNr">258 </span> <a href='064list.mu.html#L6'>list</a> <span class="Special"><-</span> push<span class="Constant"> 5</span>, <a href='064list.mu.html#L6'>list</a> <span id="L259" class="LineNr">259 </span> run [ -<span id="L260" class="LineNr">260 </span> <span class="Conceal">¦</span> list2:&:duplex-list:char <span class="Special"><-</span> <a href='065duplex_list.mu.html#L29'>next</a> list <span class="Comment"># second element</span> -<span id="L261" class="LineNr">261 </span> <span class="Conceal">¦</span> list <span class="Special"><-</span> remove list2, list +<span id="L260" class="LineNr">260 </span> <span class="Conceal">¦</span> list2:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> <a href='065duplex_list.mu.html#L29'>next</a> <a href='064list.mu.html#L6'>list</a> <span class="Comment"># second element</span> +<span id="L261" class="LineNr">261 </span> <span class="Conceal">¦</span> <a href='064list.mu.html#L6'>list</a> <span class="Special"><-</span> remove list2, <a href='064list.mu.html#L6'>list</a> <span id="L262" class="LineNr">262 </span> <span class="Conceal">¦</span> 10:bool/<span class="Special">raw</span> <span class="Special"><-</span> equal list2,<span class="Constant"> 0</span> <span id="L263" class="LineNr">263 </span> <span class="Conceal">¦</span> <span class="Comment"># check structure like before</span> -<span id="L264" class="LineNr">264 </span> <span class="Conceal">¦</span> list2 <span class="Special"><-</span> copy list +<span id="L264" class="LineNr">264 </span> <span class="Conceal">¦</span> list2 <span class="Special"><-</span> copy <a href='064list.mu.html#L6'>list</a> <span id="L265" class="LineNr">265 </span> <span class="Conceal">¦</span> 11:char/<span class="Special">raw</span> <span class="Special"><-</span> first list2 <span id="L266" class="LineNr">266 </span> <span class="Conceal">¦</span> list2 <span class="Special"><-</span> <a href='065duplex_list.mu.html#L29'>next</a> list2 <span id="L267" class="LineNr">267 </span> <span class="Conceal">¦</span> 12:char/<span class="Special">raw</span> <span class="Special"><-</span> first list2 -<span id="L268" class="LineNr">268 </span> <span class="Conceal">¦</span> 20:&:duplex-list:char/<span class="Special">raw</span> <span class="Special"><-</span> <a href='065duplex_list.mu.html#L29'>next</a> list2 +<span id="L268" class="LineNr">268 </span> <span class="Conceal">¦</span> 20:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:char/<span class="Special">raw</span> <span class="Special"><-</span> <a href='065duplex_list.mu.html#L29'>next</a> list2 <span id="L269" class="LineNr">269 </span> <span class="Conceal">¦</span> list2 <span class="Special"><-</span> <a href='065duplex_list.mu.html#L36'>prev</a> list2 <span id="L270" class="LineNr">270 </span> <span class="Conceal">¦</span> 30:char/<span class="Special">raw</span> <span class="Special"><-</span> first list2 -<span id="L271" class="LineNr">271 </span> <span class="Conceal">¦</span> 40:bool/<span class="Special">raw</span> <span class="Special"><-</span> equal list, list2 +<span id="L271" class="LineNr">271 </span> <span class="Conceal">¦</span> 40:bool/<span class="Special">raw</span> <span class="Special"><-</span> equal <a href='064list.mu.html#L6'>list</a>, list2 <span id="L272" class="LineNr">272 </span> ] <span id="L273" class="LineNr">273 </span> memory-should-contain [ <span id="L274" class="LineNr">274 </span> <span class="Conceal">¦</span><span class="Constant"> 10</span> <span class="Special"><-</span><span class="Constant"> 0</span> <span class="Comment"># remove returned non-null</span> @@ -344,20 +344,20 @@ if ('onhashchange' in window) { <span id="L282" class="LineNr">282 </span> <span id="L283" class="LineNr">283 </span><span class="muScenario">scenario</span> removing-from-start-of-duplex-list [ <span id="L284" class="LineNr">284 </span> <span class="Constant">local-scope</span> -<span id="L285" class="LineNr">285 </span> list:&:duplex-list:char <span class="Special"><-</span> push<span class="Constant"> 3</span>,<span class="Constant"> 0</span> -<span id="L286" class="LineNr">286 </span> list <span class="Special"><-</span> push<span class="Constant"> 4</span>, list -<span id="L287" class="LineNr">287 </span> list <span class="Special"><-</span> push<span class="Constant"> 5</span>, list +<span id="L285" class="LineNr">285 </span> <a href='064list.mu.html#L6'>list</a>:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> push<span class="Constant"> 3</span>,<span class="Constant"> 0</span> +<span id="L286" class="LineNr">286 </span> <a href='064list.mu.html#L6'>list</a> <span class="Special"><-</span> push<span class="Constant"> 4</span>, <a href='064list.mu.html#L6'>list</a> +<span id="L287" class="LineNr">287 </span> <a href='064list.mu.html#L6'>list</a> <span class="Special"><-</span> push<span class="Constant"> 5</span>, <a href='064list.mu.html#L6'>list</a> <span id="L288" class="LineNr">288 </span> run [ -<span id="L289" class="LineNr">289 </span> <span class="Conceal">¦</span> list <span class="Special"><-</span> remove list, list +<span id="L289" class="LineNr">289 </span> <span class="Conceal">¦</span> <a href='064list.mu.html#L6'>list</a> <span class="Special"><-</span> remove <a href='064list.mu.html#L6'>list</a>, <a href='064list.mu.html#L6'>list</a> <span id="L290" class="LineNr">290 </span> <span class="Conceal">¦</span> <span class="Comment"># check structure like before</span> -<span id="L291" class="LineNr">291 </span> <span class="Conceal">¦</span> list2:&:duplex-list:char <span class="Special"><-</span> copy list +<span id="L291" class="LineNr">291 </span> <span class="Conceal">¦</span> list2:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> copy <a href='064list.mu.html#L6'>list</a> <span id="L292" class="LineNr">292 </span> <span class="Conceal">¦</span> 10:char/<span class="Special">raw</span> <span class="Special"><-</span> first list2 <span id="L293" class="LineNr">293 </span> <span class="Conceal">¦</span> list2 <span class="Special"><-</span> <a href='065duplex_list.mu.html#L29'>next</a> list2 <span id="L294" class="LineNr">294 </span> <span class="Conceal">¦</span> 11:char/<span class="Special">raw</span> <span class="Special"><-</span> first list2 -<span id="L295" class="LineNr">295 </span> <span class="Conceal">¦</span> 20:&:duplex-list:char/<span class="Special">raw</span> <span class="Special"><-</span> <a href='065duplex_list.mu.html#L29'>next</a> list2 +<span id="L295" class="LineNr">295 </span> <span class="Conceal">¦</span> 20:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:char/<span class="Special">raw</span> <span class="Special"><-</span> <a href='065duplex_list.mu.html#L29'>next</a> list2 <span id="L296" class="LineNr">296 </span> <span class="Conceal">¦</span> list2 <span class="Special"><-</span> <a href='065duplex_list.mu.html#L36'>prev</a> list2 <span id="L297" class="LineNr">297 </span> <span class="Conceal">¦</span> 30:char/<span class="Special">raw</span> <span class="Special"><-</span> first list2 -<span id="L298" class="LineNr">298 </span> <span class="Conceal">¦</span> 40:bool/<span class="Special">raw</span> <span class="Special"><-</span> equal list, list2 +<span id="L298" class="LineNr">298 </span> <span class="Conceal">¦</span> 40:bool/<span class="Special">raw</span> <span class="Special"><-</span> equal <a href='064list.mu.html#L6'>list</a>, list2 <span id="L299" class="LineNr">299 </span> ] <span id="L300" class="LineNr">300 </span> memory-should-contain [ <span id="L301" class="LineNr">301 </span> <span class="Conceal">¦</span><span class="Constant"> 10</span> <span class="Special"><-</span><span class="Constant"> 4</span> <span class="Comment"># scanning next, skipping deleted element</span> @@ -370,24 +370,24 @@ if ('onhashchange' in window) { <span id="L308" class="LineNr">308 </span> <span id="L309" class="LineNr">309 </span><span class="muScenario">scenario</span> removing-from-end-of-duplex-list [ <span id="L310" class="LineNr">310 </span> <span class="Constant">local-scope</span> -<span id="L311" class="LineNr">311 </span> list:&:duplex-list:char <span class="Special"><-</span> push<span class="Constant"> 3</span>,<span class="Constant"> 0</span> -<span id="L312" class="LineNr">312 </span> list <span class="Special"><-</span> push<span class="Constant"> 4</span>, list -<span id="L313" class="LineNr">313 </span> list <span class="Special"><-</span> push<span class="Constant"> 5</span>, list +<span id="L311" class="LineNr">311 </span> <a href='064list.mu.html#L6'>list</a>:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> push<span class="Constant"> 3</span>,<span class="Constant"> 0</span> +<span id="L312" class="LineNr">312 </span> <a href='064list.mu.html#L6'>list</a> <span class="Special"><-</span> push<span class="Constant"> 4</span>, <a href='064list.mu.html#L6'>list</a> +<span id="L313" class="LineNr">313 </span> <a href='064list.mu.html#L6'>list</a> <span class="Special"><-</span> push<span class="Constant"> 5</span>, <a href='064list.mu.html#L6'>list</a> <span id="L314" class="LineNr">314 </span> run [ <span id="L315" class="LineNr">315 </span> <span class="Conceal">¦</span> <span class="Comment"># delete last element</span> -<span id="L316" class="LineNr">316 </span> <span class="Conceal">¦</span> list2:&:duplex-list:char <span class="Special"><-</span> <a href='065duplex_list.mu.html#L29'>next</a> list +<span id="L316" class="LineNr">316 </span> <span class="Conceal">¦</span> list2:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> <a href='065duplex_list.mu.html#L29'>next</a> <a href='064list.mu.html#L6'>list</a> <span id="L317" class="LineNr">317 </span> <span class="Conceal">¦</span> list2 <span class="Special"><-</span> <a href='065duplex_list.mu.html#L29'>next</a> list2 -<span id="L318" class="LineNr">318 </span> <span class="Conceal">¦</span> list <span class="Special"><-</span> remove list2, list +<span id="L318" class="LineNr">318 </span> <span class="Conceal">¦</span> <a href='064list.mu.html#L6'>list</a> <span class="Special"><-</span> remove list2, <a href='064list.mu.html#L6'>list</a> <span id="L319" class="LineNr">319 </span> <span class="Conceal">¦</span> 10:bool/<span class="Special">raw</span> <span class="Special"><-</span> equal list2,<span class="Constant"> 0</span> <span id="L320" class="LineNr">320 </span> <span class="Conceal">¦</span> <span class="Comment"># check structure like before</span> -<span id="L321" class="LineNr">321 </span> <span class="Conceal">¦</span> list2 <span class="Special"><-</span> copy list +<span id="L321" class="LineNr">321 </span> <span class="Conceal">¦</span> list2 <span class="Special"><-</span> copy <a href='064list.mu.html#L6'>list</a> <span id="L322" class="LineNr">322 </span> <span class="Conceal">¦</span> 11:char/<span class="Special">raw</span> <span class="Special"><-</span> first list2 <span id="L323" class="LineNr">323 </span> <span class="Conceal">¦</span> list2 <span class="Special"><-</span> <a href='065duplex_list.mu.html#L29'>next</a> list2 <span id="L324" class="LineNr">324 </span> <span class="Conceal">¦</span> 12:char/<span class="Special">raw</span> <span class="Special"><-</span> first list2 -<span id="L325" class="LineNr">325 </span> <span class="Conceal">¦</span> 20:&:duplex-list:char/<span class="Special">raw</span> <span class="Special"><-</span> <a href='065duplex_list.mu.html#L29'>next</a> list2 +<span id="L325" class="LineNr">325 </span> <span class="Conceal">¦</span> 20:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:char/<span class="Special">raw</span> <span class="Special"><-</span> <a href='065duplex_list.mu.html#L29'>next</a> list2 <span id="L326" class="LineNr">326 </span> <span class="Conceal">¦</span> list2 <span class="Special"><-</span> <a href='065duplex_list.mu.html#L36'>prev</a> list2 <span id="L327" class="LineNr">327 </span> <span class="Conceal">¦</span> 30:char/<span class="Special">raw</span> <span class="Special"><-</span> first list2 -<span id="L328" class="LineNr">328 </span> <span class="Conceal">¦</span> 40:bool/<span class="Special">raw</span> <span class="Special"><-</span> equal list, list2 +<span id="L328" class="LineNr">328 </span> <span class="Conceal">¦</span> 40:bool/<span class="Special">raw</span> <span class="Special"><-</span> equal <a href='064list.mu.html#L6'>list</a>, list2 <span id="L329" class="LineNr">329 </span> ] <span id="L330" class="LineNr">330 </span> memory-should-contain [ <span id="L331" class="LineNr">331 </span> <span class="Conceal">¦</span><span class="Constant"> 10</span> <span class="Special"><-</span><span class="Constant"> 0</span> <span class="Comment"># remove returned non-null</span> @@ -401,10 +401,10 @@ if ('onhashchange' in window) { <span id="L339" class="LineNr">339 </span> <span id="L340" class="LineNr">340 </span><span class="muScenario">scenario</span> removing-from-singleton-duplex-list [ <span id="L341" class="LineNr">341 </span> <span class="Constant">local-scope</span> -<span id="L342" class="LineNr">342 </span> list:&:duplex-list:char <span class="Special"><-</span> push<span class="Constant"> 3</span>,<span class="Constant"> 0</span> +<span id="L342" class="LineNr">342 </span> <a href='064list.mu.html#L6'>list</a>:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> push<span class="Constant"> 3</span>,<span class="Constant"> 0</span> <span id="L343" class="LineNr">343 </span> run [ -<span id="L344" class="LineNr">344 </span> <span class="Conceal">¦</span> list <span class="Special"><-</span> remove list, list -<span id="L345" class="LineNr">345 </span> <span class="Conceal">¦</span> 1:num/<span class="Special">raw</span> <span class="Special"><-</span> copy list +<span id="L344" class="LineNr">344 </span> <span class="Conceal">¦</span> <a href='064list.mu.html#L6'>list</a> <span class="Special"><-</span> remove <a href='064list.mu.html#L6'>list</a>, <a href='064list.mu.html#L6'>list</a> +<span id="L345" class="LineNr">345 </span> <span class="Conceal">¦</span> 1:num/<span class="Special">raw</span> <span class="Special"><-</span> copy <a href='064list.mu.html#L6'>list</a> <span id="L346" class="LineNr">346 </span> ] <span id="L347" class="LineNr">347 </span> memory-should-contain [ <span id="L348" class="LineNr">348 </span> <span class="Conceal">¦</span><span class="Constant"> 1</span> <span class="Special"><-</span><span class="Constant"> 0</span> <span class="Comment"># back to an empty list</span> @@ -416,10 +416,10 @@ if ('onhashchange' in window) { <span id="L354" class="LineNr">354 </span><span class="Comment"># set end to 0 to delete everything past start.</span> <span id="L355" class="LineNr">355 </span><span class="Comment"># can't set start to 0 to delete everything before end, because there's no</span> <span id="L356" class="LineNr">356 </span><span class="Comment"># clean way to return the new head pointer.</span> -<span id="L357" class="LineNr">357 </span><span class="muRecipe">def</span> <a href='065duplex_list.mu.html#L357'>remove-between</a> start:&:duplex-list:_elem, end:&:duplex-list:_elem/contained-in:start<span class="muRecipe"> -> </span>start:&:duplex-list:_elem [ +<span id="L357" class="LineNr">357 </span><span class="muRecipe">def</span> <a href='065duplex_list.mu.html#L357'>remove-between</a> start:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem, end:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem/contained-in:start<span class="muRecipe"> -> </span>start:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem [ <span id="L358" class="LineNr">358 </span> <span class="Constant">local-scope</span> <span id="L359" class="LineNr">359 </span> <span class="Constant">load-ingredients</span> -<span id="L360" class="LineNr">360 </span> <a href='065duplex_list.mu.html#L29'>next</a>:&:duplex-list:_elem <span class="Special"><-</span> get *start, <span class="Constant"><a href='065duplex_list.mu.html#L29'>next</a>:offset</span> +<span id="L360" class="LineNr">360 </span> <a href='065duplex_list.mu.html#L29'>next</a>:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem <span class="Special"><-</span> get *start, <span class="Constant"><a href='065duplex_list.mu.html#L29'>next</a>:offset</span> <span id="L361" class="LineNr">361 </span> nothing-to-delete?:bool <span class="Special"><-</span> equal <a href='065duplex_list.mu.html#L29'>next</a>, end <span id="L362" class="LineNr">362 </span> <span class="muControl">return-if</span> nothing-to-delete? <span id="L363" class="LineNr">363 </span> assert <a href='065duplex_list.mu.html#L29'>next</a>, <span class="Constant">[malformed duplex list]</span> @@ -430,8 +430,8 @@ if ('onhashchange' in window) { <span id="L368" class="LineNr">368 </span> <span class="muControl">return-unless</span> end <span id="L369" class="LineNr">369 </span> <span class="Comment"># end->prev->next = 0</span> <span id="L370" class="LineNr">370 </span> <span class="Comment"># end->prev = start</span> -<span id="L371" class="LineNr">371 </span> <a href='065duplex_list.mu.html#L36'>prev</a>:&:duplex-list:_elem <span class="Special"><-</span> get *end, <span class="Constant"><a href='065duplex_list.mu.html#L36'>prev</a>:offset</span> -<span id="L372" class="LineNr">372 </span> assert <a href='065duplex_list.mu.html#L36'>prev</a>, <span class="Constant">[malformed duplex list - 2]</span> +<span id="L371" class="LineNr">371 </span> <a href='065duplex_list.mu.html#L36'>prev</a>:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem <span class="Special"><-</span> get *end, <span class="Constant"><a href='065duplex_list.mu.html#L36'>prev</a>:offset</span> +<span id="L372" class="LineNr">372 </span> assert <a href='065duplex_list.mu.html#L36'>prev</a>, <span class="Constant">[malformed duplex <a href='064list.mu.html#L6'>list</a> - 2]</span> <span id="L373" class="LineNr">373 </span> *prev <span class="Special"><-</span> put *prev, <span class="Constant"><a href='065duplex_list.mu.html#L29'>next</a>:offset</span>,<span class="Constant"> 0</span> <span id="L374" class="LineNr">374 </span> *end <span class="Special"><-</span> put *end, <span class="Constant"><a href='065duplex_list.mu.html#L36'>prev</a>:offset</span>, start <span id="L375" class="LineNr">375 </span>] @@ -439,25 +439,25 @@ if ('onhashchange' in window) { <span id="L377" class="LineNr">377 </span><span class="muScenario">scenario</span> remove-range [ <span id="L378" class="LineNr">378 </span> <span class="Comment"># construct a duplex list with six elements [13, 14, 15, 16, 17, 18]</span> <span id="L379" class="LineNr">379 </span> <span class="Constant">local-scope</span> -<span id="L380" class="LineNr">380 </span> list:&:duplex-list:char <span class="Special"><-</span> push<span class="Constant"> 18</span>,<span class="Constant"> 0</span> -<span id="L381" class="LineNr">381 </span> list <span class="Special"><-</span> push<span class="Constant"> 17</span>, list -<span id="L382" class="LineNr">382 </span> list <span class="Special"><-</span> push<span class="Constant"> 16</span>, list -<span id="L383" class="LineNr">383 </span> list <span class="Special"><-</span> push<span class="Constant"> 15</span>, list -<span id="L384" class="LineNr">384 </span> list <span class="Special"><-</span> push<span class="Constant"> 14</span>, list -<span id="L385" class="LineNr">385 </span> list <span class="Special"><-</span> push<span class="Constant"> 13</span>, list +<span id="L380" class="LineNr">380 </span> <a href='064list.mu.html#L6'>list</a>:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> push<span class="Constant"> 18</span>,<span class="Constant"> 0</span> +<span id="L381" class="LineNr">381 </span> <a href='064list.mu.html#L6'>list</a> <span class="Special"><-</span> push<span class="Constant"> 17</span>, <a href='064list.mu.html#L6'>list</a> +<span id="L382" class="LineNr">382 </span> <a href='064list.mu.html#L6'>list</a> <span class="Special"><-</span> push<span class="Constant"> 16</span>, <a href='064list.mu.html#L6'>list</a> +<span id="L383" class="LineNr">383 </span> <a href='064list.mu.html#L6'>list</a> <span class="Special"><-</span> push<span class="Constant"> 15</span>, <a href='064list.mu.html#L6'>list</a> +<span id="L384" class="LineNr">384 </span> <a href='064list.mu.html#L6'>list</a> <span class="Special"><-</span> push<span class="Constant"> 14</span>, <a href='064list.mu.html#L6'>list</a> +<span id="L385" class="LineNr">385 </span> <a href='064list.mu.html#L6'>list</a> <span class="Special"><-</span> push<span class="Constant"> 13</span>, <a href='064list.mu.html#L6'>list</a> <span id="L386" class="LineNr">386 </span> run [ <span id="L387" class="LineNr">387 </span> <span class="Conceal">¦</span> <span class="Comment"># delete 16 onwards</span> <span id="L388" class="LineNr">388 </span> <span class="Conceal">¦</span> <span class="Comment"># first pointer: to the third element</span> -<span id="L389" class="LineNr">389 </span> <span class="Conceal">¦</span> list2:&:duplex-list:char <span class="Special"><-</span> <a href='065duplex_list.mu.html#L29'>next</a> list +<span id="L389" class="LineNr">389 </span> <span class="Conceal">¦</span> list2:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> <a href='065duplex_list.mu.html#L29'>next</a> <a href='064list.mu.html#L6'>list</a> <span id="L390" class="LineNr">390 </span> <span class="Conceal">¦</span> list2 <span class="Special"><-</span> <a href='065duplex_list.mu.html#L29'>next</a> list2 <span id="L391" class="LineNr">391 </span> <span class="Conceal">¦</span> list2 <span class="Special"><-</span> <a href='065duplex_list.mu.html#L357'>remove-between</a> list2,<span class="Constant"> 0</span> <span id="L392" class="LineNr">392 </span> <span class="Conceal">¦</span> <span class="Comment"># now check the list</span> <span id="L393" class="LineNr">393 </span> <span class="Conceal">¦</span> 10:char/<span class="Special">raw</span> <span class="Special"><-</span> get *list, <span class="Constant">value:offset</span> -<span id="L394" class="LineNr">394 </span> <span class="Conceal">¦</span> list <span class="Special"><-</span> <a href='065duplex_list.mu.html#L29'>next</a> list +<span id="L394" class="LineNr">394 </span> <span class="Conceal">¦</span> <a href='064list.mu.html#L6'>list</a> <span class="Special"><-</span> <a href='065duplex_list.mu.html#L29'>next</a> <a href='064list.mu.html#L6'>list</a> <span id="L395" class="LineNr">395 </span> <span class="Conceal">¦</span> 11:char/<span class="Special">raw</span> <span class="Special"><-</span> get *list, <span class="Constant">value:offset</span> -<span id="L396" class="LineNr">396 </span> <span class="Conceal">¦</span> list <span class="Special"><-</span> <a href='065duplex_list.mu.html#L29'>next</a> list +<span id="L396" class="LineNr">396 </span> <span class="Conceal">¦</span> <a href='064list.mu.html#L6'>list</a> <span class="Special"><-</span> <a href='065duplex_list.mu.html#L29'>next</a> <a href='064list.mu.html#L6'>list</a> <span id="L397" class="LineNr">397 </span> <span class="Conceal">¦</span> 12:char/<span class="Special">raw</span> <span class="Special"><-</span> get *list, <span class="Constant">value:offset</span> -<span id="L398" class="LineNr">398 </span> <span class="Conceal">¦</span> 20:&:duplex-list:char/<span class="Special">raw</span> <span class="Special"><-</span> <a href='065duplex_list.mu.html#L29'>next</a> list +<span id="L398" class="LineNr">398 </span> <span class="Conceal">¦</span> 20:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:char/<span class="Special">raw</span> <span class="Special"><-</span> <a href='065duplex_list.mu.html#L29'>next</a> <a href='064list.mu.html#L6'>list</a> <span id="L399" class="LineNr">399 </span> ] <span id="L400" class="LineNr">400 </span> memory-should-contain [ <span id="L401" class="LineNr">401 </span> <span class="Conceal">¦</span><span class="Constant"> 10</span> <span class="Special"><-</span><span class="Constant"> 13</span> @@ -470,29 +470,29 @@ if ('onhashchange' in window) { <span id="L408" class="LineNr">408 </span><span class="muScenario">scenario</span> remove-range-to-final [ <span id="L409" class="LineNr">409 </span> <span class="Constant">local-scope</span> <span id="L410" class="LineNr">410 </span> <span class="Comment"># construct a duplex list with six elements [13, 14, 15, 16, 17, 18]</span> -<span id="L411" class="LineNr">411 </span> list:&:duplex-list:char <span class="Special"><-</span> push<span class="Constant"> 18</span>,<span class="Constant"> 0</span> -<span id="L412" class="LineNr">412 </span> list <span class="Special"><-</span> push<span class="Constant"> 17</span>, list -<span id="L413" class="LineNr">413 </span> list <span class="Special"><-</span> push<span class="Constant"> 16</span>, list -<span id="L414" class="LineNr">414 </span> list <span class="Special"><-</span> push<span class="Constant"> 15</span>, list -<span id="L415" class="LineNr">415 </span> list <span class="Special"><-</span> push<span class="Constant"> 14</span>, list -<span id="L416" class="LineNr">416 </span> list <span class="Special"><-</span> push<span class="Constant"> 13</span>, list +<span id="L411" class="LineNr">411 </span> <a href='064list.mu.html#L6'>list</a>:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> push<span class="Constant"> 18</span>,<span class="Constant"> 0</span> +<span id="L412" class="LineNr">412 </span> <a href='064list.mu.html#L6'>list</a> <span class="Special"><-</span> push<span class="Constant"> 17</span>, <a href='064list.mu.html#L6'>list</a> +<span id="L413" class="LineNr">413 </span> <a href='064list.mu.html#L6'>list</a> <span class="Special"><-</span> push<span class="Constant"> 16</span>, <a href='064list.mu.html#L6'>list</a> +<span id="L414" class="LineNr">414 </span> <a href='064list.mu.html#L6'>list</a> <span class="Special"><-</span> push<span class="Constant"> 15</span>, <a href='064list.mu.html#L6'>list</a> +<span id="L415" class="LineNr">415 </span> <a href='064list.mu.html#L6'>list</a> <span class="Special"><-</span> push<span class="Constant"> 14</span>, <a href='064list.mu.html#L6'>list</a> +<span id="L416" class="LineNr">416 </span> <a href='064list.mu.html#L6'>list</a> <span class="Special"><-</span> push<span class="Constant"> 13</span>, <a href='064list.mu.html#L6'>list</a> <span id="L417" class="LineNr">417 </span> run [ <span id="L418" class="LineNr">418 </span> <span class="Conceal">¦</span> <span class="Comment"># delete 15, 16 and 17</span> <span id="L419" class="LineNr">419 </span> <span class="Conceal">¦</span> <span class="Comment"># start pointer: to the second element</span> -<span id="L420" class="LineNr">420 </span> <span class="Conceal">¦</span> list2:&:duplex-list:char <span class="Special"><-</span> <a href='065duplex_list.mu.html#L29'>next</a> list +<span id="L420" class="LineNr">420 </span> <span class="Conceal">¦</span> list2:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> <a href='065duplex_list.mu.html#L29'>next</a> <a href='064list.mu.html#L6'>list</a> <span id="L421" class="LineNr">421 </span> <span class="Conceal">¦</span> <span class="Comment"># end pointer: to the last (sixth) element</span> -<span id="L422" class="LineNr">422 </span> <span class="Conceal">¦</span> end:&:duplex-list:char <span class="Special"><-</span> <a href='065duplex_list.mu.html#L29'>next</a> list2 +<span id="L422" class="LineNr">422 </span> <span class="Conceal">¦</span> end:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> <a href='065duplex_list.mu.html#L29'>next</a> list2 <span id="L423" class="LineNr">423 </span> <span class="Conceal">¦</span> end <span class="Special"><-</span> <a href='065duplex_list.mu.html#L29'>next</a> end <span id="L424" class="LineNr">424 </span> <span class="Conceal">¦</span> end <span class="Special"><-</span> <a href='065duplex_list.mu.html#L29'>next</a> end <span id="L425" class="LineNr">425 </span> <span class="Conceal">¦</span> end <span class="Special"><-</span> <a href='065duplex_list.mu.html#L29'>next</a> end <span id="L426" class="LineNr">426 </span> <span class="Conceal">¦</span> <a href='065duplex_list.mu.html#L357'>remove-between</a> list2, end <span id="L427" class="LineNr">427 </span> <span class="Conceal">¦</span> <span class="Comment"># now check the list</span> <span id="L428" class="LineNr">428 </span> <span class="Conceal">¦</span> 10:char/<span class="Special">raw</span> <span class="Special"><-</span> get *list, <span class="Constant">value:offset</span> -<span id="L429" class="LineNr">429 </span> <span class="Conceal">¦</span> list <span class="Special"><-</span> <a href='065duplex_list.mu.html#L29'>next</a> list +<span id="L429" class="LineNr">429 </span> <span class="Conceal">¦</span> <a href='064list.mu.html#L6'>list</a> <span class="Special"><-</span> <a href='065duplex_list.mu.html#L29'>next</a> <a href='064list.mu.html#L6'>list</a> <span id="L430" class="LineNr">430 </span> <span class="Conceal">¦</span> 11:char/<span class="Special">raw</span> <span class="Special"><-</span> get *list, <span class="Constant">value:offset</span> -<span id="L431" class="LineNr">431 </span> <span class="Conceal">¦</span> list <span class="Special"><-</span> <a href='065duplex_list.mu.html#L29'>next</a> list +<span id="L431" class="LineNr">431 </span> <span class="Conceal">¦</span> <a href='064list.mu.html#L6'>list</a> <span class="Special"><-</span> <a href='065duplex_list.mu.html#L29'>next</a> <a href='064list.mu.html#L6'>list</a> <span id="L432" class="LineNr">432 </span> <span class="Conceal">¦</span> 12:char/<span class="Special">raw</span> <span class="Special"><-</span> get *list, <span class="Constant">value:offset</span> -<span id="L433" class="LineNr">433 </span> <span class="Conceal">¦</span> 20:&:duplex-list:char/<span class="Special">raw</span> <span class="Special"><-</span> <a href='065duplex_list.mu.html#L29'>next</a> list +<span id="L433" class="LineNr">433 </span> <span class="Conceal">¦</span> 20:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:char/<span class="Special">raw</span> <span class="Special"><-</span> <a href='065duplex_list.mu.html#L29'>next</a> <a href='064list.mu.html#L6'>list</a> <span id="L434" class="LineNr">434 </span> ] <span id="L435" class="LineNr">435 </span> memory-should-contain [ <span id="L436" class="LineNr">436 </span> <span class="Conceal">¦</span><span class="Constant"> 10</span> <span class="Special"><-</span><span class="Constant"> 13</span> @@ -505,20 +505,20 @@ if ('onhashchange' in window) { <span id="L443" class="LineNr">443 </span><span class="muScenario">scenario</span> remove-range-empty [ <span id="L444" class="LineNr">444 </span> <span class="Constant">local-scope</span> <span id="L445" class="LineNr">445 </span> <span class="Comment"># construct a duplex list with three elements [13, 14, 15]</span> -<span id="L446" class="LineNr">446 </span> list:&:duplex-list:char <span class="Special"><-</span> push<span class="Constant"> 15</span>,<span class="Constant"> 0</span> -<span id="L447" class="LineNr">447 </span> list <span class="Special"><-</span> push<span class="Constant"> 14</span>, list -<span id="L448" class="LineNr">448 </span> list <span class="Special"><-</span> push<span class="Constant"> 13</span>, list +<span id="L446" class="LineNr">446 </span> <a href='064list.mu.html#L6'>list</a>:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> push<span class="Constant"> 15</span>,<span class="Constant"> 0</span> +<span id="L447" class="LineNr">447 </span> <a href='064list.mu.html#L6'>list</a> <span class="Special"><-</span> push<span class="Constant"> 14</span>, <a href='064list.mu.html#L6'>list</a> +<span id="L448" class="LineNr">448 </span> <a href='064list.mu.html#L6'>list</a> <span class="Special"><-</span> push<span class="Constant"> 13</span>, <a href='064list.mu.html#L6'>list</a> <span id="L449" class="LineNr">449 </span> run [ <span id="L450" class="LineNr">450 </span> <span class="Conceal">¦</span> <span class="Comment"># delete between first and second element (i.e. nothing)</span> -<span id="L451" class="LineNr">451 </span> <span class="Conceal">¦</span> list2:&:duplex-list:char <span class="Special"><-</span> <a href='065duplex_list.mu.html#L29'>next</a> list -<span id="L452" class="LineNr">452 </span> <span class="Conceal">¦</span> <a href='065duplex_list.mu.html#L357'>remove-between</a> list, list2 +<span id="L451" class="LineNr">451 </span> <span class="Conceal">¦</span> list2:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> <a href='065duplex_list.mu.html#L29'>next</a> <a href='064list.mu.html#L6'>list</a> +<span id="L452" class="LineNr">452 </span> <span class="Conceal">¦</span> <a href='065duplex_list.mu.html#L357'>remove-between</a> <a href='064list.mu.html#L6'>list</a>, list2 <span id="L453" class="LineNr">453 </span> <span class="Conceal">¦</span> <span class="Comment"># now check the list</span> <span id="L454" class="LineNr">454 </span> <span class="Conceal">¦</span> 10:char/<span class="Special">raw</span> <span class="Special"><-</span> get *list, <span class="Constant">value:offset</span> -<span id="L455" class="LineNr">455 </span> <span class="Conceal">¦</span> list <span class="Special"><-</span> <a href='065duplex_list.mu.html#L29'>next</a> list +<span id="L455" class="LineNr">455 </span> <span class="Conceal">¦</span> <a href='064list.mu.html#L6'>list</a> <span class="Special"><-</span> <a href='065duplex_list.mu.html#L29'>next</a> <a href='064list.mu.html#L6'>list</a> <span id="L456" class="LineNr">456 </span> <span class="Conceal">¦</span> 11:char/<span class="Special">raw</span> <span class="Special"><-</span> get *list, <span class="Constant">value:offset</span> -<span id="L457" class="LineNr">457 </span> <span class="Conceal">¦</span> list <span class="Special"><-</span> <a href='065duplex_list.mu.html#L29'>next</a> list +<span id="L457" class="LineNr">457 </span> <span class="Conceal">¦</span> <a href='064list.mu.html#L6'>list</a> <span class="Special"><-</span> <a href='065duplex_list.mu.html#L29'>next</a> <a href='064list.mu.html#L6'>list</a> <span id="L458" class="LineNr">458 </span> <span class="Conceal">¦</span> 12:char/<span class="Special">raw</span> <span class="Special"><-</span> get *list, <span class="Constant">value:offset</span> -<span id="L459" class="LineNr">459 </span> <span class="Conceal">¦</span> 20:&:duplex-list:char/<span class="Special">raw</span> <span class="Special"><-</span> <a href='065duplex_list.mu.html#L29'>next</a> list +<span id="L459" class="LineNr">459 </span> <span class="Conceal">¦</span> 20:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:char/<span class="Special">raw</span> <span class="Special"><-</span> <a href='065duplex_list.mu.html#L29'>next</a> <a href='064list.mu.html#L6'>list</a> <span id="L460" class="LineNr">460 </span> ] <span id="L461" class="LineNr">461 </span> <span class="Comment"># no change</span> <span id="L462" class="LineNr">462 </span> memory-should-contain [ @@ -532,21 +532,21 @@ if ('onhashchange' in window) { <span id="L470" class="LineNr">470 </span><span class="muScenario">scenario</span> remove-range-to-end [ <span id="L471" class="LineNr">471 </span> <span class="Constant">local-scope</span> <span id="L472" class="LineNr">472 </span> <span class="Comment"># construct a duplex list with six elements [13, 14, 15, 16, 17, 18]</span> -<span id="L473" class="LineNr">473 </span> list:&:duplex-list:char <span class="Special"><-</span> push<span class="Constant"> 18</span>,<span class="Constant"> 0</span> -<span id="L474" class="LineNr">474 </span> list <span class="Special"><-</span> push<span class="Constant"> 17</span>, list -<span id="L475" class="LineNr">475 </span> list <span class="Special"><-</span> push<span class="Constant"> 16</span>, list -<span id="L476" class="LineNr">476 </span> list <span class="Special"><-</span> push<span class="Constant"> 15</span>, list -<span id="L477" class="LineNr">477 </span> list <span class="Special"><-</span> push<span class="Constant"> 14</span>, list -<span id="L478" class="LineNr">478 </span> list <span class="Special"><-</span> push<span class="Constant"> 13</span>, list +<span id="L473" class="LineNr">473 </span> <a href='064list.mu.html#L6'>list</a>:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> push<span class="Constant"> 18</span>,<span class="Constant"> 0</span> +<span id="L474" class="LineNr">474 </span> <a href='064list.mu.html#L6'>list</a> <span class="Special"><-</span> push<span class="Constant"> 17</span>, <a href='064list.mu.html#L6'>list</a> +<span id="L475" class="LineNr">475 </span> <a href='064list.mu.html#L6'>list</a> <span class="Special"><-</span> push<span class="Constant"> 16</span>, <a href='064list.mu.html#L6'>list</a> +<span id="L476" class="LineNr">476 </span> <a href='064list.mu.html#L6'>list</a> <span class="Special"><-</span> push<span class="Constant"> 15</span>, <a href='064list.mu.html#L6'>list</a> +<span id="L477" class="LineNr">477 </span> <a href='064list.mu.html#L6'>list</a> <span class="Special"><-</span> push<span class="Constant"> 14</span>, <a href='064list.mu.html#L6'>list</a> +<span id="L478" class="LineNr">478 </span> <a href='064list.mu.html#L6'>list</a> <span class="Special"><-</span> push<span class="Constant"> 13</span>, <a href='064list.mu.html#L6'>list</a> <span id="L479" class="LineNr">479 </span> run [ <span id="L480" class="LineNr">480 </span> <span class="Conceal">¦</span> <span class="Comment"># remove the third element and beyond</span> -<span id="L481" class="LineNr">481 </span> <span class="Conceal">¦</span> list2:&:duplex-list:char <span class="Special"><-</span> <a href='065duplex_list.mu.html#L29'>next</a> list +<span id="L481" class="LineNr">481 </span> <span class="Conceal">¦</span> list2:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> <a href='065duplex_list.mu.html#L29'>next</a> <a href='064list.mu.html#L6'>list</a> <span id="L482" class="LineNr">482 </span> <span class="Conceal">¦</span> <a href='065duplex_list.mu.html#L357'>remove-between</a> list2,<span class="Constant"> 0</span> <span id="L483" class="LineNr">483 </span> <span class="Conceal">¦</span> <span class="Comment"># now check the list</span> <span id="L484" class="LineNr">484 </span> <span class="Conceal">¦</span> 10:char/<span class="Special">raw</span> <span class="Special"><-</span> get *list, <span class="Constant">value:offset</span> -<span id="L485" class="LineNr">485 </span> <span class="Conceal">¦</span> list <span class="Special"><-</span> <a href='065duplex_list.mu.html#L29'>next</a> list +<span id="L485" class="LineNr">485 </span> <span class="Conceal">¦</span> <a href='064list.mu.html#L6'>list</a> <span class="Special"><-</span> <a href='065duplex_list.mu.html#L29'>next</a> <a href='064list.mu.html#L6'>list</a> <span id="L486" class="LineNr">486 </span> <span class="Conceal">¦</span> 11:char/<span class="Special">raw</span> <span class="Special"><-</span> get *list, <span class="Constant">value:offset</span> -<span id="L487" class="LineNr">487 </span> <span class="Conceal">¦</span> 20:&:duplex-list:char/<span class="Special">raw</span> <span class="Special"><-</span> <a href='065duplex_list.mu.html#L29'>next</a> list +<span id="L487" class="LineNr">487 </span> <span class="Conceal">¦</span> 20:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:char/<span class="Special">raw</span> <span class="Special"><-</span> <a href='065duplex_list.mu.html#L29'>next</a> <a href='064list.mu.html#L6'>list</a> <span id="L488" class="LineNr">488 </span> ] <span id="L489" class="LineNr">489 </span> memory-should-contain [ <span id="L490" class="LineNr">490 </span> <span class="Conceal">¦</span><span class="Constant"> 10</span> <span class="Special"><-</span><span class="Constant"> 13</span> @@ -556,19 +556,19 @@ if ('onhashchange' in window) { <span id="L494" class="LineNr">494 </span>] <span id="L495" class="LineNr">495 </span> <span id="L496" class="LineNr">496 </span><span class="Comment"># insert list beginning at 'new' after 'in'</span> -<span id="L497" class="LineNr">497 </span><span class="muRecipe">def</span> <a href='065duplex_list.mu.html#L497'>insert-range</a> in:&:duplex-list:_elem, start:&:duplex-list:_elem/contained-in:in<span class="muRecipe"> -> </span>in:&:duplex-list:_elem [ +<span id="L497" class="LineNr">497 </span><span class="muRecipe">def</span> <a href='065duplex_list.mu.html#L497'>insert-range</a> in:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem, start:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem/contained-in:in<span class="muRecipe"> -> </span>in:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem [ <span id="L498" class="LineNr">498 </span> <span class="Constant">local-scope</span> <span id="L499" class="LineNr">499 </span> <span class="Constant">load-ingredients</span> <span id="L500" class="LineNr">500 </span> <span class="muControl">return-unless</span> in <span id="L501" class="LineNr">501 </span> <span class="muControl">return-unless</span> start -<span id="L502" class="LineNr">502 </span> end:&:duplex-list:_elem <span class="Special"><-</span> copy start +<span id="L502" class="LineNr">502 </span> end:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem <span class="Special"><-</span> copy start <span id="L503" class="LineNr">503 </span> <span class="Delimiter">{</span> -<span id="L504" class="LineNr">504 </span> <span class="Conceal">¦</span> <a href='065duplex_list.mu.html#L29'>next</a>:&:duplex-list:_elem <span class="Special"><-</span> <a href='065duplex_list.mu.html#L29'>next</a> end/insert-range +<span id="L504" class="LineNr">504 </span> <span class="Conceal">¦</span> <a href='065duplex_list.mu.html#L29'>next</a>:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem <span class="Special"><-</span> <a href='065duplex_list.mu.html#L29'>next</a> end/insert-range <span id="L505" class="LineNr">505 </span> <span class="Conceal">¦</span> <span class="muControl">break-unless</span> <a href='065duplex_list.mu.html#L29'>next</a> <span id="L506" class="LineNr">506 </span> <span class="Conceal">¦</span> end <span class="Special"><-</span> copy <a href='065duplex_list.mu.html#L29'>next</a> <span id="L507" class="LineNr">507 </span> <span class="Conceal">¦</span> <span class="muControl">loop</span> <span id="L508" class="LineNr">508 </span> <span class="Delimiter">}</span> -<span id="L509" class="LineNr">509 </span> <a href='065duplex_list.mu.html#L29'>next</a>:&:duplex-list:_elem <span class="Special"><-</span> <a href='065duplex_list.mu.html#L29'>next</a> in +<span id="L509" class="LineNr">509 </span> <a href='065duplex_list.mu.html#L29'>next</a>:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem <span class="Special"><-</span> <a href='065duplex_list.mu.html#L29'>next</a> in <span id="L510" class="LineNr">510 </span> *end <span class="Special"><-</span> put *end, <span class="Constant"><a href='065duplex_list.mu.html#L29'>next</a>:offset</span>, <a href='065duplex_list.mu.html#L29'>next</a> <span id="L511" class="LineNr">511 </span> <span class="Delimiter">{</span> <span id="L512" class="LineNr">512 </span> <span class="Conceal">¦</span> <span class="muControl">break-unless</span> <a href='065duplex_list.mu.html#L29'>next</a> @@ -578,21 +578,21 @@ if ('onhashchange' in window) { <span id="L516" class="LineNr">516 </span> *start <span class="Special"><-</span> put *start, <span class="Constant"><a href='065duplex_list.mu.html#L36'>prev</a>:offset</span>, in <span id="L517" class="LineNr">517 </span>] <span id="L518" class="LineNr">518 </span> -<span id="L519" class="LineNr">519 </span><span class="muRecipe">def</span> append in:&:duplex-list:_elem, new:&:duplex-list:_elem/contained-in:in<span class="muRecipe"> -> </span>in:&:duplex-list:_elem [ +<span id="L519" class="LineNr">519 </span><span class="muRecipe">def</span> append in:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem, new:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem/contained-in:in<span class="muRecipe"> -> </span>in:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem [ <span id="L520" class="LineNr">520 </span> <span class="Constant">local-scope</span> <span id="L521" class="LineNr">521 </span> <span class="Constant">load-ingredients</span> -<span id="L522" class="LineNr">522 </span> <a href='065duplex_list.mu.html#L528'>last</a>:&:duplex-list:_elem <span class="Special"><-</span> <a href='065duplex_list.mu.html#L528'>last</a> in +<span id="L522" class="LineNr">522 </span> <a href='065duplex_list.mu.html#L528'>last</a>:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem <span class="Special"><-</span> <a href='065duplex_list.mu.html#L528'>last</a> in <span id="L523" class="LineNr">523 </span> *last <span class="Special"><-</span> put *last, <span class="Constant"><a href='065duplex_list.mu.html#L29'>next</a>:offset</span>, new <span id="L524" class="LineNr">524 </span> <span class="muControl">return-unless</span> new <span id="L525" class="LineNr">525 </span> *new <span class="Special"><-</span> put *new, <span class="Constant"><a href='065duplex_list.mu.html#L36'>prev</a>:offset</span>, <a href='065duplex_list.mu.html#L528'>last</a> <span id="L526" class="LineNr">526 </span>] <span id="L527" class="LineNr">527 </span> -<span id="L528" class="LineNr">528 </span><span class="muRecipe">def</span> <a href='065duplex_list.mu.html#L528'>last</a> in:&:duplex-list:_elem<span class="muRecipe"> -> </span>result:&:duplex-list:_elem [ +<span id="L528" class="LineNr">528 </span><span class="muRecipe">def</span> <a href='065duplex_list.mu.html#L528'>last</a> in:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem<span class="muRecipe"> -> </span>result:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem [ <span id="L529" class="LineNr">529 </span> <span class="Constant">local-scope</span> <span id="L530" class="LineNr">530 </span> <span class="Constant">load-ingredients</span> <span id="L531" class="LineNr">531 </span> result <span class="Special"><-</span> copy in <span id="L532" class="LineNr">532 </span> <span class="Delimiter">{</span> -<span id="L533" class="LineNr">533 </span> <span class="Conceal">¦</span> <a href='065duplex_list.mu.html#L29'>next</a>:&:duplex-list:_elem <span class="Special"><-</span> <a href='065duplex_list.mu.html#L29'>next</a> result +<span id="L533" class="LineNr">533 </span> <span class="Conceal">¦</span> <a href='065duplex_list.mu.html#L29'>next</a>:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem <span class="Special"><-</span> <a href='065duplex_list.mu.html#L29'>next</a> result <span id="L534" class="LineNr">534 </span> <span class="Conceal">¦</span> <span class="muControl">break-unless</span> <a href='065duplex_list.mu.html#L29'>next</a> <span id="L535" class="LineNr">535 </span> <span class="Conceal">¦</span> result <span class="Special"><-</span> copy <a href='065duplex_list.mu.html#L29'>next</a> <span id="L536" class="LineNr">536 </span> <span class="Conceal">¦</span> <span class="muControl">loop</span> @@ -600,7 +600,7 @@ if ('onhashchange' in window) { <span id="L538" class="LineNr">538 </span>] <span id="L539" class="LineNr">539 </span> <span id="L540" class="LineNr">540 </span><span class="Comment"># helper for debugging</span> -<span id="L541" class="LineNr">541 </span><span class="muRecipe">def</span> <a href='065duplex_list.mu.html#L541'>dump-from</a> x:&:duplex-list:_elem [ +<span id="L541" class="LineNr">541 </span><span class="muRecipe">def</span> <a href='065duplex_list.mu.html#L541'>dump-from</a> x:&:<a href='065duplex_list.mu.html#L3'>duplex-list</a>:_elem [ <span id="L542" class="LineNr">542 </span> <span class="Constant">local-scope</span> <span id="L543" class="LineNr">543 </span> <span class="Constant">load-ingredients</span> <span id="L544" class="LineNr">544 </span> $print x, <span class="Constant">[: ]</span> diff --git a/html/066stream.mu.html b/html/066stream.mu.html index 556654bd..4a993384 100644 --- a/html/066stream.mu.html +++ b/html/066stream.mu.html @@ -60,12 +60,12 @@ if ('onhashchange' in window) { <body onload='JumpToLine();'> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment"># new type to help incrementally scan arrays</span> -<span id="L2" class="LineNr"> 2 </span><span class="muData">container</span> stream:_elem [ +<span id="L2" class="LineNr"> 2 </span><span class="muData">container</span> <a href='066stream.mu.html#L2'>stream</a>:_elem [ <span id="L3" class="LineNr"> 3 </span> index:num <span id="L4" class="LineNr"> 4 </span> data:&:@:_elem <span id="L5" class="LineNr"> 5 </span>] <span id="L6" class="LineNr"> 6 </span> -<span id="L7" class="LineNr"> 7 </span><span class="muRecipe">def</span> <a href='066stream.mu.html#L7'>new-stream</a> s:&:@:_elem<span class="muRecipe"> -> </span>result:&:stream:_elem [ +<span id="L7" class="LineNr"> 7 </span><span class="muRecipe">def</span> <a href='066stream.mu.html#L7'>new-stream</a> s:&:@:_elem<span class="muRecipe"> -> </span>result:&:<a href='066stream.mu.html#L2'>stream</a>:_elem [ <span id="L8" class="LineNr"> 8 </span> <span class="Constant">local-scope</span> <span id="L9" class="LineNr"> 9 </span> <span class="Constant">load-ingredients</span> <span id="L10" class="LineNr">10 </span> <span class="muControl">return-unless</span> s, <span class="Constant">0/null</span> @@ -74,17 +74,17 @@ if ('onhashchange' in window) { <span id="L13" class="LineNr">13 </span> *result <span class="Special"><-</span> put *result, <span class="Constant">data:offset</span>, s <span id="L14" class="LineNr">14 </span>] <span id="L15" class="LineNr">15 </span> -<span id="L16" class="LineNr">16 </span><span class="muRecipe">def</span> <a href='066stream.mu.html#L16'>rewind</a> in:&:stream:_elem<span class="muRecipe"> -> </span>in:&:stream:_elem [ +<span id="L16" class="LineNr">16 </span><span class="muRecipe">def</span> <a href='066stream.mu.html#L16'>rewind</a> in:&:<a href='066stream.mu.html#L2'>stream</a>:_elem<span class="muRecipe"> -> </span>in:&:<a href='066stream.mu.html#L2'>stream</a>:_elem [ <span id="L17" class="LineNr">17 </span> <span class="Constant">local-scope</span> <span id="L18" class="LineNr">18 </span> <span class="Constant">load-ingredients</span> <span id="L19" class="LineNr">19 </span> <span class="muControl">return-unless</span> in <span id="L20" class="LineNr">20 </span> *in <span class="Special"><-</span> put *in, <span class="Constant">index:offset</span>,<span class="Constant"> 0</span> <span id="L21" class="LineNr">21 </span>] <span id="L22" class="LineNr">22 </span> -<span id="L23" class="LineNr">23 </span><span class="muRecipe">def</span> read in:&:stream:_elem<span class="muRecipe"> -> </span>result:_elem, empty?:bool, in:&:stream:_elem [ +<span id="L23" class="LineNr">23 </span><span class="muRecipe">def</span> read in:&:<a href='066stream.mu.html#L2'>stream</a>:_elem<span class="muRecipe"> -> </span>result:_elem, empty?:bool, in:&:<a href='066stream.mu.html#L2'>stream</a>:_elem [ <span id="L24" class="LineNr">24 </span> <span class="Constant">local-scope</span> <span id="L25" class="LineNr">25 </span> <span class="Constant">load-ingredients</span> -<span id="L26" class="LineNr">26 </span> assert in, <span class="Constant">[cannot read; stream has no data]</span> +<span id="L26" class="LineNr">26 </span> assert in, <span class="Constant">[cannot read; <a href='066stream.mu.html#L2'>stream</a> has no data]</span> <span id="L27" class="LineNr">27 </span> empty? <span class="Special"><-</span> copy <span class="Constant">0/false</span> <span id="L28" class="LineNr">28 </span> idx:num <span class="Special"><-</span> get *in, <span class="Constant">index:offset</span> <span id="L29" class="LineNr">29 </span> s:&:@:_elem <span class="Special"><-</span> get *in, <span class="Constant">data:offset</span> @@ -100,10 +100,10 @@ if ('onhashchange' in window) { <span id="L39" class="LineNr">39 </span> *in <span class="Special"><-</span> put *in, <span class="Constant">index:offset</span>, idx <span id="L40" class="LineNr">40 </span>] <span id="L41" class="LineNr">41 </span> -<span id="L42" class="LineNr">42 </span><span class="muRecipe">def</span> <a href='066stream.mu.html#L42'>peek</a> in:&:stream:_elem<span class="muRecipe"> -> </span>result:_elem, empty?:bool [ +<span id="L42" class="LineNr">42 </span><span class="muRecipe">def</span> <a href='066stream.mu.html#L42'>peek</a> in:&:<a href='066stream.mu.html#L2'>stream</a>:_elem<span class="muRecipe"> -> </span>result:_elem, empty?:bool [ <span id="L43" class="LineNr">43 </span> <span class="Constant">local-scope</span> <span id="L44" class="LineNr">44 </span> <span class="Constant">load-ingredients</span> -<span id="L45" class="LineNr">45 </span> assert in, <span class="Constant">[cannot peek; stream has no data]</span> +<span id="L45" class="LineNr">45 </span> assert in, <span class="Constant">[cannot peek; <a href='066stream.mu.html#L2'>stream</a> has no data]</span> <span id="L46" class="LineNr">46 </span> empty?:bool <span class="Special"><-</span> copy <span class="Constant">0/false</span> <span id="L47" class="LineNr">47 </span> idx:num <span class="Special"><-</span> get *in, <span class="Constant">index:offset</span> <span id="L48" class="LineNr">48 </span> s:&:@:_elem <span class="Special"><-</span> get *in, <span class="Constant">data:offset</span> @@ -117,10 +117,10 @@ if ('onhashchange' in window) { <span id="L56" class="LineNr">56 </span> result <span class="Special"><-</span> index *s, idx <span id="L57" class="LineNr">57 </span>] <span id="L58" class="LineNr">58 </span> -<span id="L59" class="LineNr">59 </span><span class="muRecipe">def</span> <a href='066stream.mu.html#L59'>read-line</a> in:&:stream:char<span class="muRecipe"> -> </span>result:text, in:&:stream:char [ +<span id="L59" class="LineNr">59 </span><span class="muRecipe">def</span> <a href='066stream.mu.html#L59'>read-line</a> in:&:<a href='066stream.mu.html#L2'>stream</a>:char<span class="muRecipe"> -> </span>result:text, in:&:<a href='066stream.mu.html#L2'>stream</a>:char [ <span id="L60" class="LineNr">60 </span> <span class="Constant">local-scope</span> <span id="L61" class="LineNr">61 </span> <span class="Constant">load-ingredients</span> -<span id="L62" class="LineNr">62 </span> assert in, <span class="Constant">[cannot read-line; stream has no data]</span> +<span id="L62" class="LineNr">62 </span> assert in, <span class="Constant">[cannot read-line; <a href='066stream.mu.html#L2'>stream</a> has no data]</span> <span id="L63" class="LineNr">63 </span> idx:num <span class="Special"><-</span> get *in, <span class="Constant">index:offset</span> <span id="L64" class="LineNr">64 </span> s:text <span class="Special"><-</span> get *in, <span class="Constant">data:offset</span> <span id="L65" class="LineNr">65 </span> next-idx:num <span class="Special"><-</span> find-next s, <span class="Constant">10/newline</span>, idx @@ -130,10 +130,10 @@ if ('onhashchange' in window) { <span id="L69" class="LineNr">69 </span> *in <span class="Special"><-</span> put *in, <span class="Constant">index:offset</span>, idx <span id="L70" class="LineNr">70 </span>] <span id="L71" class="LineNr">71 </span> -<span id="L72" class="LineNr">72 </span><span class="muRecipe">def</span> <a href='066stream.mu.html#L72'>end-of-stream?</a> in:&:stream:_elem<span class="muRecipe"> -> </span>result:bool [ +<span id="L72" class="LineNr">72 </span><span class="muRecipe">def</span> <a href='066stream.mu.html#L72'>end-of-stream?</a> in:&:<a href='066stream.mu.html#L2'>stream</a>:_elem<span class="muRecipe"> -> </span>result:bool [ <span id="L73" class="LineNr">73 </span> <span class="Constant">local-scope</span> <span id="L74" class="LineNr">74 </span> <span class="Constant">load-ingredients</span> -<span id="L75" class="LineNr">75 </span> assert in, <span class="Constant">[cannot check end-of-stream?; stream has no data]</span> +<span id="L75" class="LineNr">75 </span> assert in, <span class="Constant">[cannot check end-of-stream?; <a href='066stream.mu.html#L2'>stream</a> has no data]</span> <span id="L76" class="LineNr">76 </span> idx:num <span class="Special"><-</span> get *in, <span class="Constant">index:offset</span> <span id="L77" class="LineNr">77 </span> s:&:@:_elem <span class="Special"><-</span> get *in, <span class="Constant">data:offset</span> <span id="L78" class="LineNr">78 </span> len:num <span class="Special"><-</span> length *s diff --git a/html/068random.mu.html b/html/068random.mu.html index 9828a44e..2c695c2f 100644 --- a/html/068random.mu.html +++ b/html/068random.mu.html @@ -59,7 +59,7 @@ if ('onhashchange' in window) { </head> <body onload='JumpToLine();'> <pre id='vimCodeElement'> -<span id="L1" class="LineNr"> 1 </span><span class="muRecipe">def</span> <a href='068random.mu.html#L1'>random</a> generator:&:stream:num<span class="muRecipe"> -> </span>result:num, fail?:bool, generator:&:stream:num [ +<span id="L1" class="LineNr"> 1 </span><span class="muRecipe">def</span> <a href='068random.mu.html#L1'>random</a> generator:&:<a href='066stream.mu.html#L2'>stream</a>:num<span class="muRecipe"> -> </span>result:num, fail?:bool, generator:&:<a href='066stream.mu.html#L2'>stream</a>:num [ <span id="L2" class="LineNr"> 2 </span> <span class="Constant">local-scope</span> <span id="L3" class="LineNr"> 3 </span> <span class="Constant">load-ingredients</span> <span id="L4" class="LineNr"> 4 </span> <span class="Delimiter">{</span> @@ -72,7 +72,7 @@ if ('onhashchange' in window) { <span id="L11" class="LineNr">11 </span>] <span id="L12" class="LineNr">12 </span> <span id="L13" class="LineNr">13 </span><span class="Comment"># helper for tests</span> -<span id="L14" class="LineNr">14 </span><span class="muRecipe">def</span> <a href='068random.mu.html#L14'>assume-random-numbers</a><span class="muRecipe"> -> </span>result:&:stream:num [ +<span id="L14" class="LineNr">14 </span><span class="muRecipe">def</span> <a href='068random.mu.html#L14'>assume-random-numbers</a><span class="muRecipe"> -> </span>result:&:<a href='066stream.mu.html#L2'>stream</a>:num [ <span id="L15" class="LineNr">15 </span> <span class="Constant">local-scope</span> <span id="L16" class="LineNr">16 </span> <span class="Constant">load-ingredients</span> <span id="L17" class="LineNr">17 </span> <span class="Comment"># compute result-len, space to allocate in result</span> @@ -98,11 +98,11 @@ if ('onhashchange' in window) { <span id="L37" class="LineNr">37 </span> <span id="L38" class="LineNr">38 </span><span class="muScenario">scenario</span> random-numbers-in-scenario [ <span id="L39" class="LineNr">39 </span> <span class="Constant">local-scope</span> -<span id="L40" class="LineNr">40 </span> source:&:stream:num <span class="Special"><-</span> <a href='068random.mu.html#L14'>assume-random-numbers</a><span class="Constant"> 34</span>,<span class="Constant"> 35</span>,<span class="Constant"> 37</span> -<span id="L41" class="LineNr">41 </span> 1:num/<span class="Special">raw</span>, 2:bool/<span class="Special">raw</span> <span class="Special"><-</span> <a href='068random.mu.html#L1'>random</a> source -<span id="L42" class="LineNr">42 </span> 3:num/<span class="Special">raw</span>, 4:bool/<span class="Special">raw</span> <span class="Special"><-</span> <a href='068random.mu.html#L1'>random</a> source -<span id="L43" class="LineNr">43 </span> 5:num/<span class="Special">raw</span>, 6:bool/<span class="Special">raw</span> <span class="Special"><-</span> <a href='068random.mu.html#L1'>random</a> source -<span id="L44" class="LineNr">44 </span> 7:num/<span class="Special">raw</span>, 8:bool/<span class="Special">raw</span> <span class="Special"><-</span> <a href='068random.mu.html#L1'>random</a> source +<span id="L40" class="LineNr">40 </span> <a href='075channel.mu.html#L43'>source</a>:&:<a href='066stream.mu.html#L2'>stream</a>:num <span class="Special"><-</span> <a href='068random.mu.html#L14'>assume-random-numbers</a><span class="Constant"> 34</span>,<span class="Constant"> 35</span>,<span class="Constant"> 37</span> +<span id="L41" class="LineNr">41 </span> 1:num/<span class="Special">raw</span>, 2:bool/<span class="Special">raw</span> <span class="Special"><-</span> <a href='068random.mu.html#L1'>random</a> <a href='075channel.mu.html#L43'>source</a> +<span id="L42" class="LineNr">42 </span> 3:num/<span class="Special">raw</span>, 4:bool/<span class="Special">raw</span> <span class="Special"><-</span> <a href='068random.mu.html#L1'>random</a> <a href='075channel.mu.html#L43'>source</a> +<span id="L43" class="LineNr">43 </span> 5:num/<span class="Special">raw</span>, 6:bool/<span class="Special">raw</span> <span class="Special"><-</span> <a href='068random.mu.html#L1'>random</a> <a href='075channel.mu.html#L43'>source</a> +<span id="L44" class="LineNr">44 </span> 7:num/<span class="Special">raw</span>, 8:bool/<span class="Special">raw</span> <span class="Special"><-</span> <a href='068random.mu.html#L1'>random</a> <a href='075channel.mu.html#L43'>source</a> <span id="L45" class="LineNr">45 </span> memory-should-contain [ <span id="L46" class="LineNr">46 </span> <span class="Conceal">¦</span><span class="Constant"> 1</span> <span class="Special"><-</span><span class="Constant"> 34</span> <span id="L47" class="LineNr">47 </span> <span class="Conceal">¦</span><span class="Constant"> 2</span> <span class="Special"><-</span><span class="Constant"> 0</span> <span class="Comment"># everything went well</span> @@ -116,7 +116,7 @@ if ('onhashchange' in window) { <span id="L55" class="LineNr">55 </span>] <span id="L56" class="LineNr">56 </span> <span id="L57" class="LineNr">57 </span><span class="Comment"># generate a random integer in the semi-open interval [start, end)</span> -<span id="L58" class="LineNr">58 </span><span class="muRecipe">def</span> <a href='068random.mu.html#L58'>random-in-range</a> generator:&:stream:num, start:num, end:num<span class="muRecipe"> -> </span>result:num, fail?:bool, generator:&:stream:num [ +<span id="L58" class="LineNr">58 </span><span class="muRecipe">def</span> <a href='068random.mu.html#L58'>random-in-range</a> generator:&:<a href='066stream.mu.html#L2'>stream</a>:num, start:num, end:num<span class="muRecipe"> -> </span>result:num, fail?:bool, generator:&:<a href='066stream.mu.html#L2'>stream</a>:num [ <span id="L59" class="LineNr">59 </span> <span class="Constant">local-scope</span> <span id="L60" class="LineNr">60 </span> <span class="Constant">load-ingredients</span> <span id="L61" class="LineNr">61 </span> result, fail?, generator <span class="Special"><-</span> <a href='068random.mu.html#L1'>random</a> generator @@ -128,8 +128,8 @@ if ('onhashchange' in window) { <span id="L67" class="LineNr">67 </span> <span id="L68" class="LineNr">68 </span><span class="muScenario">scenario</span> <a href='068random.mu.html#L58'>random-in-range</a> [ <span id="L69" class="LineNr">69 </span> <span class="Constant">local-scope</span> -<span id="L70" class="LineNr">70 </span> source:&:stream:num <span class="Special"><-</span> <a href='068random.mu.html#L14'>assume-random-numbers</a><span class="Constant"> 91</span> -<span id="L71" class="LineNr">71 </span> 1:num/<span class="Special">raw</span> <span class="Special"><-</span> <a href='068random.mu.html#L58'>random-in-range</a> source,<span class="Constant"> 40</span>,<span class="Constant"> 50</span> +<span id="L70" class="LineNr">70 </span> <a href='075channel.mu.html#L43'>source</a>:&:<a href='066stream.mu.html#L2'>stream</a>:num <span class="Special"><-</span> <a href='068random.mu.html#L14'>assume-random-numbers</a><span class="Constant"> 91</span> +<span id="L71" class="LineNr">71 </span> 1:num/<span class="Special">raw</span> <span class="Special"><-</span> <a href='068random.mu.html#L58'>random-in-range</a> <a href='075channel.mu.html#L43'>source</a>,<span class="Constant"> 40</span>,<span class="Constant"> 50</span> <span id="L72" class="LineNr">72 </span> memory-should-contain [ <span id="L73" class="LineNr">73 </span> <span class="Conceal">¦</span><span class="Constant"> 1</span> <span class="Special"><-</span><span class="Constant"> 41</span> <span id="L74" class="LineNr">74 </span> ] diff --git a/html/070table.mu.html b/html/070table.mu.html index 2a7ee07f..603e9997 100644 --- a/html/070table.mu.html +++ b/html/070table.mu.html @@ -67,7 +67,7 @@ if ('onhashchange' in window) { <span id="L5" class="LineNr"> 5 </span> <span id="L6" class="LineNr"> 6 </span><span class="muScenario">scenario</span> table-read-write [ <span id="L7" class="LineNr"> 7 </span> <span class="Constant">local-scope</span> -<span id="L8" class="LineNr"> 8 </span> tab:&:table:num:num <span class="Special"><-</span> <a href='070table.mu.html#L56'>new-table</a><span class="Constant"> 30</span> +<span id="L8" class="LineNr"> 8 </span> tab:&:<a href='070table.mu.html#L44'>table</a>:num:num <span class="Special"><-</span> <a href='070table.mu.html#L56'>new-table</a><span class="Constant"> 30</span> <span id="L9" class="LineNr"> 9 </span> run [ <span id="L10" class="LineNr"> 10 </span> <span class="Conceal">¦</span> put-index tab,<span class="Constant"> 12</span>,<span class="Constant"> 34</span> <span id="L11" class="LineNr"> 11 </span> <span class="Conceal">¦</span> 60:num/<span class="Special">raw</span>, 61:bool/<span class="Special">raw</span> <span class="Special"><-</span> index tab,<span class="Constant"> 12</span> @@ -80,7 +80,7 @@ if ('onhashchange' in window) { <span id="L18" class="LineNr"> 18 </span> <span id="L19" class="LineNr"> 19 </span><span class="muScenario">scenario</span> table-read-write-non-integer [ <span id="L20" class="LineNr"> 20 </span> <span class="Constant">local-scope</span> -<span id="L21" class="LineNr"> 21 </span> tab:&:table:text:num <span class="Special"><-</span> <a href='070table.mu.html#L56'>new-table</a><span class="Constant"> 30</span> +<span id="L21" class="LineNr"> 21 </span> tab:&:<a href='070table.mu.html#L44'>table</a>:text:num <span class="Special"><-</span> <a href='070table.mu.html#L56'>new-table</a><span class="Constant"> 30</span> <span id="L22" class="LineNr"> 22 </span> run [ <span id="L23" class="LineNr"> 23 </span> <span class="Conceal">¦</span> put-index tab, <span class="Constant">[abc def]</span>,<span class="Constant"> 34</span> <span id="L24" class="LineNr"> 24 </span> <span class="Conceal">¦</span> 1:num/<span class="Special">raw</span>, 2:bool/<span class="Special">raw</span> <span class="Special"><-</span> index tab, <span class="Constant">[abc def]</span> @@ -93,7 +93,7 @@ if ('onhashchange' in window) { <span id="L31" class="LineNr"> 31 </span> <span id="L32" class="LineNr"> 32 </span><span class="muScenario">scenario</span> table-read-not-found [ <span id="L33" class="LineNr"> 33 </span> <span class="Constant">local-scope</span> -<span id="L34" class="LineNr"> 34 </span> tab:&:table:text:num <span class="Special"><-</span> <a href='070table.mu.html#L56'>new-table</a><span class="Constant"> 30</span> +<span id="L34" class="LineNr"> 34 </span> tab:&:<a href='070table.mu.html#L44'>table</a>:text:num <span class="Special"><-</span> <a href='070table.mu.html#L56'>new-table</a><span class="Constant"> 30</span> <span id="L35" class="LineNr"> 35 </span> run [ <span id="L36" class="LineNr"> 36 </span> <span class="Conceal">¦</span> 1:num/<span class="Special">raw</span>, 2:bool/<span class="Special">raw</span> <span class="Special"><-</span> index tab, <span class="Constant">[abc def]</span> <span id="L37" class="LineNr"> 37 </span> ] @@ -103,29 +103,29 @@ if ('onhashchange' in window) { <span id="L41" class="LineNr"> 41 </span> ] <span id="L42" class="LineNr"> 42 </span>] <span id="L43" class="LineNr"> 43 </span> -<span id="L44" class="LineNr"> 44 </span><span class="muData">container</span> table:_key:_value [ +<span id="L44" class="LineNr"> 44 </span><span class="muData">container</span> <a href='070table.mu.html#L44'>table</a>:_key:_value [ <span id="L45" class="LineNr"> 45 </span> length:num <span id="L46" class="LineNr"> 46 </span> <a href='075channel.mu.html#L379'>capacity</a>:num -<span id="L47" class="LineNr"> 47 </span> data:&:@:table-row:_key:_value +<span id="L47" class="LineNr"> 47 </span> data:&:@:<a href='070table.mu.html#L50'>table-row</a>:_key:_value <span id="L48" class="LineNr"> 48 </span>] <span id="L49" class="LineNr"> 49 </span> -<span id="L50" class="LineNr"> 50 </span><span class="muData">container</span> table-row:_key:_value [ +<span id="L50" class="LineNr"> 50 </span><span class="muData">container</span> <a href='070table.mu.html#L50'>table-row</a>:_key:_value [ <span id="L51" class="LineNr"> 51 </span> occupied?:bool <span id="L52" class="LineNr"> 52 </span> key:_key <span id="L53" class="LineNr"> 53 </span> value:_value <span id="L54" class="LineNr"> 54 </span>] <span id="L55" class="LineNr"> 55 </span> -<span id="L56" class="LineNr"> 56 </span><span class="muRecipe">def</span> <a href='070table.mu.html#L56'>new-table</a> <a href='075channel.mu.html#L379'>capacity</a>:num<span class="muRecipe"> -> </span>result:&:table:_key:_value [ +<span id="L56" class="LineNr"> 56 </span><span class="muRecipe">def</span> <a href='070table.mu.html#L56'>new-table</a> <a href='075channel.mu.html#L379'>capacity</a>:num<span class="muRecipe"> -> </span>result:&:<a href='070table.mu.html#L44'>table</a>:_key:_value [ <span id="L57" class="LineNr"> 57 </span> <span class="Constant">local-scope</span> <span id="L58" class="LineNr"> 58 </span> <span class="Constant">load-ingredients</span> <span id="L59" class="LineNr"> 59 </span> result <span class="Special"><-</span> new <span class="Delimiter">{</span>(table _key _value): type<span class="Delimiter">}</span> -<span id="L60" class="LineNr"> 60 </span> data:&:@:table-row:_key:_value <span class="Special"><-</span> new <span class="Delimiter">{</span>(table-row _key _value): type<span class="Delimiter">}</span>, <a href='075channel.mu.html#L379'>capacity</a> +<span id="L60" class="LineNr"> 60 </span> data:&:@:<a href='070table.mu.html#L50'>table-row</a>:_key:_value <span class="Special"><-</span> new <span class="Delimiter">{</span>(table-row _key _value): type<span class="Delimiter">}</span>, <a href='075channel.mu.html#L379'>capacity</a> <span id="L61" class="LineNr"> 61 </span> *result <span class="Special"><-</span> merge <span class="Constant">0/length</span>, <a href='075channel.mu.html#L379'>capacity</a>, data <span id="L62" class="LineNr"> 62 </span>] <span id="L63" class="LineNr"> 63 </span> <span id="L64" class="LineNr"> 64 </span><span class="Comment"># todo: tag results as /required so that call-sites are forbidden from ignoring them</span> <span id="L65" class="LineNr"> 65 </span><span class="Comment"># then we could handle conflicts simply by resizing the table</span> -<span id="L66" class="LineNr"> 66 </span><span class="muRecipe">def</span> put-index table:&:table:_key:_value, key:_key, value:_value<span class="muRecipe"> -> </span>table:&:table:_key:_value [ +<span id="L66" class="LineNr"> 66 </span><span class="muRecipe">def</span> put-index <a href='070table.mu.html#L44'>table</a>:&:<a href='070table.mu.html#L44'>table</a>:_key:_value, key:_key, value:_value<span class="muRecipe"> -> </span><a href='070table.mu.html#L44'>table</a>:&:<a href='070table.mu.html#L44'>table</a>:_key:_value [ <span id="L67" class="LineNr"> 67 </span> <span class="Constant">local-scope</span> <span id="L68" class="LineNr"> 68 </span> <span class="Constant">load-ingredients</span> <span id="L69" class="LineNr"> 69 </span> hash:num <span class="Special"><-</span> hash key @@ -133,16 +133,16 @@ if ('onhashchange' in window) { <span id="L71" class="LineNr"> 71 </span> <a href='075channel.mu.html#L379'>capacity</a>:num <span class="Special"><-</span> get *table, <span class="Constant"><a href='075channel.mu.html#L379'>capacity</a>:offset</span> <span id="L72" class="LineNr"> 72 </span> _, hash-key:num <span class="Special"><-</span> divide-with-remainder hash, <a href='075channel.mu.html#L379'>capacity</a> <span id="L73" class="LineNr"> 73 </span> hash-key <span class="Special"><-</span> <a href='070table.mu.html#L103'>abs</a> hash-key <span class="Comment"># in case hash overflows from a double into a negative integer inside 'divide-with-remainder' above</span> -<span id="L74" class="LineNr"> 74 </span> table-data:&:@:table-row:_key:_value <span class="Special"><-</span> get *table, <span class="Constant">data:offset</span> -<span id="L75" class="LineNr"> 75 </span> x:table-row:_key:_value <span class="Special"><-</span> index *table-data, hash-key +<span id="L74" class="LineNr"> 74 </span> table-data:&:@:<a href='070table.mu.html#L50'>table-row</a>:_key:_value <span class="Special"><-</span> get *table, <span class="Constant">data:offset</span> +<span id="L75" class="LineNr"> 75 </span> x:<a href='070table.mu.html#L50'>table-row</a>:_key:_value <span class="Special"><-</span> index *table-data, hash-key <span id="L76" class="LineNr"> 76 </span> occupied?:bool <span class="Special"><-</span> get x, <span class="Constant">occupied?:offset</span> <span id="L77" class="LineNr"> 77 </span> not-occupied?:bool <span class="Special"><-</span> not occupied?:bool <span id="L78" class="LineNr"> 78 </span> assert not-occupied?, <span class="Constant">[can't handle collisions yet]</span> -<span id="L79" class="LineNr"> 79 </span> new-row:table-row:_key:_value <span class="Special"><-</span> merge <span class="Constant">1/true</span>, key, value +<span id="L79" class="LineNr"> 79 </span> new-row:<a href='070table.mu.html#L50'>table-row</a>:_key:_value <span class="Special"><-</span> merge <span class="Constant">1/true</span>, key, value <span id="L80" class="LineNr"> 80 </span> *table-data <span class="Special"><-</span> put-index *table-data, hash-key, new-row <span id="L81" class="LineNr"> 81 </span>] <span id="L82" class="LineNr"> 82 </span> -<span id="L83" class="LineNr"> 83 </span><span class="muRecipe">def</span> index table:&:table:_key:_value, key:_key<span class="muRecipe"> -> </span>result:_value, found?:bool [ +<span id="L83" class="LineNr"> 83 </span><span class="muRecipe">def</span> index <a href='070table.mu.html#L44'>table</a>:&:<a href='070table.mu.html#L44'>table</a>:_key:_value, key:_key<span class="muRecipe"> -> </span>result:_value, found?:bool [ <span id="L84" class="LineNr"> 84 </span> <span class="Constant">local-scope</span> <span id="L85" class="LineNr"> 85 </span> <span class="Constant">load-ingredients</span> <span id="L86" class="LineNr"> 86 </span> hash:num <span class="Special"><-</span> hash key @@ -150,8 +150,8 @@ if ('onhashchange' in window) { <span id="L88" class="LineNr"> 88 </span> <a href='075channel.mu.html#L379'>capacity</a>:num <span class="Special"><-</span> get *table, <span class="Constant"><a href='075channel.mu.html#L379'>capacity</a>:offset</span> <span id="L89" class="LineNr"> 89 </span> _, hash-key:num <span class="Special"><-</span> divide-with-remainder hash, <a href='075channel.mu.html#L379'>capacity</a> <span id="L90" class="LineNr"> 90 </span> hash-key <span class="Special"><-</span> <a href='070table.mu.html#L103'>abs</a> hash-key <span class="Comment"># in case hash overflows from a double into a negative integer inside 'divide-with-remainder' above</span> -<span id="L91" class="LineNr"> 91 </span> table-data:&:@:table-row:_key:_value <span class="Special"><-</span> get *table, <span class="Constant">data:offset</span> -<span id="L92" class="LineNr"> 92 </span> x:table-row:_key:_value <span class="Special"><-</span> index *table-data, hash-key +<span id="L91" class="LineNr"> 91 </span> table-data:&:@:<a href='070table.mu.html#L50'>table-row</a>:_key:_value <span class="Special"><-</span> get *table, <span class="Constant">data:offset</span> +<span id="L92" class="LineNr"> 92 </span> x:<a href='070table.mu.html#L50'>table-row</a>:_key:_value <span class="Special"><-</span> index *table-data, hash-key <span id="L93" class="LineNr"> 93 </span> empty:&:_value <span class="Special"><-</span> new <span class="Constant">_value:type</span> <span id="L94" class="LineNr"> 94 </span> result <span class="Special"><-</span> copy *empty <span id="L95" class="LineNr"> 95 </span> found?:bool <span class="Special"><-</span> get x, <span class="Constant">occupied?:offset</span> diff --git a/html/075channel.mu.html b/html/075channel.mu.html index 46c82b68..a5c50400 100644 --- a/html/075channel.mu.html +++ b/html/075channel.mu.html @@ -81,9 +81,9 @@ if ('onhashchange' in window) { <span id="L17" class="LineNr"> 17 </span><span class="muScenario">scenario</span> channel [ <span id="L18" class="LineNr"> 18 </span> run [ <span id="L19" class="LineNr"> 19 </span> <span class="Conceal">¦</span> <span class="Constant">local-scope</span> -<span id="L20" class="LineNr"> 20 </span> <span class="Conceal">¦</span> source:&:source:num, sink:&:sink:num <span class="Special"><-</span> <a href='075channel.mu.html#L51'>new-channel</a> <span class="Constant">3/capacity</span> -<span id="L21" class="LineNr"> 21 </span> <span class="Conceal">¦</span> sink <span class="Special"><-</span> <a href='075channel.mu.html#L66'>write</a> sink,<span class="Constant"> 34</span> -<span id="L22" class="LineNr"> 22 </span> <span class="Conceal">¦</span> 10:num/<span class="Special">raw</span>, 11:bool/<span class="Special">raw</span>, source <span class="Special"><-</span> read source +<span id="L20" class="LineNr"> 20 </span> <span class="Conceal">¦</span> <a href='075channel.mu.html#L43'>source</a>:&:<a href='075channel.mu.html#L43'>source</a>:num, <a href='075channel.mu.html#L47'>sink</a>:&:<a href='075channel.mu.html#L47'>sink</a>:num <span class="Special"><-</span> <a href='075channel.mu.html#L51'>new-channel</a> <span class="Constant">3/capacity</span> +<span id="L21" class="LineNr"> 21 </span> <span class="Conceal">¦</span> <a href='075channel.mu.html#L47'>sink</a> <span class="Special"><-</span> <a href='075channel.mu.html#L66'>write</a> <a href='075channel.mu.html#L47'>sink</a>,<span class="Constant"> 34</span> +<span id="L22" class="LineNr"> 22 </span> <span class="Conceal">¦</span> 10:num/<span class="Special">raw</span>, 11:bool/<span class="Special">raw</span>, <a href='075channel.mu.html#L43'>source</a> <span class="Special"><-</span> read <a href='075channel.mu.html#L43'>source</a> <span id="L23" class="LineNr"> 23 </span> ] <span id="L24" class="LineNr"> 24 </span> memory-should-contain [ <span id="L25" class="LineNr"> 25 </span> <span class="Conceal">¦</span><span class="Constant"> 10</span> <span class="Special"><-</span><span class="Constant"> 34</span> @@ -104,15 +104,15 @@ if ('onhashchange' in window) { <span id="L40" class="LineNr"> 40 </span><span class="Comment"># Since channels have two ends, and since it's an error to use either end from</span> <span id="L41" class="LineNr"> 41 </span><span class="Comment"># multiple routines, let's distinguish the ends.</span> <span id="L42" class="LineNr"> 42 </span> -<span id="L43" class="LineNr"> 43 </span><span class="muData">container</span> source:_elem [ +<span id="L43" class="LineNr"> 43 </span><span class="muData">container</span> <a href='075channel.mu.html#L43'>source</a>:_elem [ <span id="L44" class="LineNr"> 44 </span> chan:&:channel:_elem <span id="L45" class="LineNr"> 45 </span>] <span id="L46" class="LineNr"> 46 </span> -<span id="L47" class="LineNr"> 47 </span><span class="muData">container</span> sink:_elem [ +<span id="L47" class="LineNr"> 47 </span><span class="muData">container</span> <a href='075channel.mu.html#L47'>sink</a>:_elem [ <span id="L48" class="LineNr"> 48 </span> chan:&:channel:_elem <span id="L49" class="LineNr"> 49 </span>] <span id="L50" class="LineNr"> 50 </span> -<span id="L51" class="LineNr"> 51 </span><span class="muRecipe">def</span> <a href='075channel.mu.html#L51'>new-channel</a> <a href='075channel.mu.html#L379'>capacity</a>:num<span class="muRecipe"> -> </span>in:&:source:_elem, out:&:sink:_elem [ +<span id="L51" class="LineNr"> 51 </span><span class="muRecipe">def</span> <a href='075channel.mu.html#L51'>new-channel</a> <a href='075channel.mu.html#L379'>capacity</a>:num<span class="muRecipe"> -> </span>in:&:<a href='075channel.mu.html#L43'>source</a>:_elem, out:&:<a href='075channel.mu.html#L47'>sink</a>:_elem [ <span id="L52" class="LineNr"> 52 </span> <span class="Constant">local-scope</span> <span id="L53" class="LineNr"> 53 </span> <span class="Constant">load-ingredients</span> <span id="L54" class="LineNr"> 54 </span> result:&:channel:_elem <span class="Special"><-</span> new <span class="Delimiter">{</span>(channel _elem): type<span class="Delimiter">}</span> @@ -127,7 +127,7 @@ if ('onhashchange' in window) { <span id="L63" class="LineNr"> 63 </span> *out <span class="Special"><-</span> put *out, <span class="Constant">chan:offset</span>, result <span id="L64" class="LineNr"> 64 </span>] <span id="L65" class="LineNr"> 65 </span> -<span id="L66" class="LineNr"> 66 </span><span class="muRecipe">def</span> <a href='075channel.mu.html#L66'>write</a> out:&:sink:_elem, val:_elem<span class="muRecipe"> -> </span>out:&:sink:_elem [ +<span id="L66" class="LineNr"> 66 </span><span class="muRecipe">def</span> <a href='075channel.mu.html#L66'>write</a> out:&:<a href='075channel.mu.html#L47'>sink</a>:_elem, val:_elem<span class="muRecipe"> -> </span>out:&:<a href='075channel.mu.html#L47'>sink</a>:_elem [ <span id="L67" class="LineNr"> 67 </span> <span class="Constant">local-scope</span> <span id="L68" class="LineNr"> 68 </span> <span class="Constant">load-ingredients</span> <span id="L69" class="LineNr"> 69 </span> assert out, <span class="Constant">[write to null channel]</span> @@ -172,7 +172,7 @@ if ('onhashchange' in window) { <span id="L108" class="LineNr">108 </span> reset lock <span id="L109" class="LineNr">109 </span>] <span id="L110" class="LineNr">110 </span> -<span id="L111" class="LineNr">111 </span><span class="muRecipe">def</span> read in:&:source:_elem<span class="muRecipe"> -> </span>result:_elem, eof?:bool, in:&:source:_elem [ +<span id="L111" class="LineNr">111 </span><span class="muRecipe">def</span> read in:&:<a href='075channel.mu.html#L43'>source</a>:_elem<span class="muRecipe"> -> </span>result:_elem, eof?:bool, in:&:<a href='075channel.mu.html#L43'>source</a>:_elem [ <span id="L112" class="LineNr">112 </span> <span class="Constant">local-scope</span> <span id="L113" class="LineNr">113 </span> <span class="Constant">load-ingredients</span> <span id="L114" class="LineNr">114 </span> assert in, <span class="Constant">[read on null channel]</span> @@ -222,7 +222,7 @@ if ('onhashchange' in window) { <span id="L158" class="LineNr">158 </span><span class="Comment"># todo: create a notion of iterator and iterable so we can read/write whole</span> <span id="L159" class="LineNr">159 </span><span class="Comment"># aggregates (arrays, lists, ..) of _elems at once.</span> <span id="L160" class="LineNr">160 </span> -<span id="L161" class="LineNr">161 </span><span class="muRecipe">def</span> <a href='075channel.mu.html#L161'>clear</a> in:&:source:_elem<span class="muRecipe"> -> </span>in:&:source:_elem [ +<span id="L161" class="LineNr">161 </span><span class="muRecipe">def</span> <a href='075channel.mu.html#L161'>clear</a> in:&:<a href='075channel.mu.html#L43'>source</a>:_elem<span class="muRecipe"> -> </span>in:&:<a href='075channel.mu.html#L43'>source</a>:_elem [ <span id="L162" class="LineNr">162 </span> <span class="Constant">local-scope</span> <span id="L163" class="LineNr">163 </span> <span class="Constant">load-ingredients</span> <span id="L164" class="LineNr">164 </span> chan:&:channel:_elem <span class="Special"><-</span> get *in, <span class="Constant">chan:offset</span> @@ -236,7 +236,7 @@ if ('onhashchange' in window) { <span id="L172" class="LineNr">172 </span><span class="muScenario">scenario</span> channel-initialization [ <span id="L173" class="LineNr">173 </span> run [ <span id="L174" class="LineNr">174 </span> <span class="Conceal">¦</span> <span class="Constant">local-scope</span> -<span id="L175" class="LineNr">175 </span> <span class="Conceal">¦</span> source:&:source:num <span class="Special"><-</span> <a href='075channel.mu.html#L51'>new-channel</a> <span class="Constant">3/capacity</span> +<span id="L175" class="LineNr">175 </span> <span class="Conceal">¦</span> <a href='075channel.mu.html#L43'>source</a>:&:<a href='075channel.mu.html#L43'>source</a>:num <span class="Special"><-</span> <a href='075channel.mu.html#L51'>new-channel</a> <span class="Constant">3/capacity</span> <span id="L176" class="LineNr">176 </span> <span class="Conceal">¦</span> chan:&:channel:num <span class="Special"><-</span> get *source, <span class="Constant">chan:offset</span> <span id="L177" class="LineNr">177 </span> <span class="Conceal">¦</span> 10:num/<span class="Special">raw</span> <span class="Special"><-</span> get *chan, <span class="Constant">first-full:offset</span> <span id="L178" class="LineNr">178 </span> <span class="Conceal">¦</span> 11:num/<span class="Special">raw</span> <span class="Special"><-</span> get *chan, <span class="Constant">first-free:offset</span> @@ -249,9 +249,9 @@ if ('onhashchange' in window) { <span id="L185" class="LineNr">185 </span> <span id="L186" class="LineNr">186 </span><span class="muScenario">scenario</span> channel-write-increments-free [ <span id="L187" class="LineNr">187 </span> <span class="Constant">local-scope</span> -<span id="L188" class="LineNr">188 </span> _, sink:&:sink:num <span class="Special"><-</span> <a href='075channel.mu.html#L51'>new-channel</a> <span class="Constant">3/capacity</span> +<span id="L188" class="LineNr">188 </span> _, <a href='075channel.mu.html#L47'>sink</a>:&:<a href='075channel.mu.html#L47'>sink</a>:num <span class="Special"><-</span> <a href='075channel.mu.html#L51'>new-channel</a> <span class="Constant">3/capacity</span> <span id="L189" class="LineNr">189 </span> run [ -<span id="L190" class="LineNr">190 </span> <span class="Conceal">¦</span> sink <span class="Special"><-</span> <a href='075channel.mu.html#L66'>write</a> sink,<span class="Constant"> 34</span> +<span id="L190" class="LineNr">190 </span> <span class="Conceal">¦</span> <a href='075channel.mu.html#L47'>sink</a> <span class="Special"><-</span> <a href='075channel.mu.html#L66'>write</a> <a href='075channel.mu.html#L47'>sink</a>,<span class="Constant"> 34</span> <span id="L191" class="LineNr">191 </span> <span class="Conceal">¦</span> chan:&:channel:num <span class="Special"><-</span> get *sink, <span class="Constant">chan:offset</span> <span id="L192" class="LineNr">192 </span> <span class="Conceal">¦</span> 10:num/<span class="Special">raw</span> <span class="Special"><-</span> get *chan, <span class="Constant">first-full:offset</span> <span id="L193" class="LineNr">193 </span> <span class="Conceal">¦</span> 11:num/<span class="Special">raw</span> <span class="Special"><-</span> get *chan, <span class="Constant">first-free:offset</span> @@ -264,10 +264,10 @@ if ('onhashchange' in window) { <span id="L200" class="LineNr">200 </span> <span id="L201" class="LineNr">201 </span><span class="muScenario">scenario</span> channel-read-increments-full [ <span id="L202" class="LineNr">202 </span> <span class="Constant">local-scope</span> -<span id="L203" class="LineNr">203 </span> source:&:source:num, sink:&:sink:num <span class="Special"><-</span> <a href='075channel.mu.html#L51'>new-channel</a> <span class="Constant">3/capacity</span> -<span id="L204" class="LineNr">204 </span> sink <span class="Special"><-</span> <a href='075channel.mu.html#L66'>write</a> sink,<span class="Constant"> 34</span> +<span id="L203" class="LineNr">203 </span> <a href='075channel.mu.html#L43'>source</a>:&:<a href='075channel.mu.html#L43'>source</a>:num, <a href='075channel.mu.html#L47'>sink</a>:&:<a href='075channel.mu.html#L47'>sink</a>:num <span class="Special"><-</span> <a href='075channel.mu.html#L51'>new-channel</a> <span class="Constant">3/capacity</span> +<span id="L204" class="LineNr">204 </span> <a href='075channel.mu.html#L47'>sink</a> <span class="Special"><-</span> <a href='075channel.mu.html#L66'>write</a> <a href='075channel.mu.html#L47'>sink</a>,<span class="Constant"> 34</span> <span id="L205" class="LineNr">205 </span> run [ -<span id="L206" class="LineNr">206 </span> <span class="Conceal">¦</span> _, _, source <span class="Special"><-</span> read source +<span id="L206" class="LineNr">206 </span> <span class="Conceal">¦</span> _, _, <a href='075channel.mu.html#L43'>source</a> <span class="Special"><-</span> read <a href='075channel.mu.html#L43'>source</a> <span id="L207" class="LineNr">207 </span> <span class="Conceal">¦</span> chan:&:channel:num <span class="Special"><-</span> get *source, <span class="Constant">chan:offset</span> <span id="L208" class="LineNr">208 </span> <span class="Conceal">¦</span> 10:num/<span class="Special">raw</span> <span class="Special"><-</span> get *chan, <span class="Constant">first-full:offset</span> <span id="L209" class="LineNr">209 </span> <span class="Conceal">¦</span> 11:num/<span class="Special">raw</span> <span class="Special"><-</span> get *chan, <span class="Constant">first-free:offset</span> @@ -281,20 +281,20 @@ if ('onhashchange' in window) { <span id="L217" class="LineNr">217 </span><span class="muScenario">scenario</span> channel-wrap [ <span id="L218" class="LineNr">218 </span> <span class="Constant">local-scope</span> <span id="L219" class="LineNr">219 </span> <span class="Comment"># channel with just 1 slot</span> -<span id="L220" class="LineNr">220 </span> source:&:source:num, sink:&:sink:num <span class="Special"><-</span> <a href='075channel.mu.html#L51'>new-channel</a> <span class="Constant">1/capacity</span> +<span id="L220" class="LineNr">220 </span> <a href='075channel.mu.html#L43'>source</a>:&:<a href='075channel.mu.html#L43'>source</a>:num, <a href='075channel.mu.html#L47'>sink</a>:&:<a href='075channel.mu.html#L47'>sink</a>:num <span class="Special"><-</span> <a href='075channel.mu.html#L51'>new-channel</a> <span class="Constant">1/capacity</span> <span id="L221" class="LineNr">221 </span> chan:&:channel:num <span class="Special"><-</span> get *source, <span class="Constant">chan:offset</span> <span id="L222" class="LineNr">222 </span> <span class="Comment"># write and read a value</span> -<span id="L223" class="LineNr">223 </span> sink <span class="Special"><-</span> <a href='075channel.mu.html#L66'>write</a> sink,<span class="Constant"> 34</span> -<span id="L224" class="LineNr">224 </span> _, _, source <span class="Special"><-</span> read source +<span id="L223" class="LineNr">223 </span> <a href='075channel.mu.html#L47'>sink</a> <span class="Special"><-</span> <a href='075channel.mu.html#L66'>write</a> <a href='075channel.mu.html#L47'>sink</a>,<span class="Constant"> 34</span> +<span id="L224" class="LineNr">224 </span> _, _, <a href='075channel.mu.html#L43'>source</a> <span class="Special"><-</span> read <a href='075channel.mu.html#L43'>source</a> <span id="L225" class="LineNr">225 </span> run [ <span id="L226" class="LineNr">226 </span> <span class="Conceal">¦</span> <span class="Comment"># first-free will now be 1</span> <span id="L227" class="LineNr">227 </span> <span class="Conceal">¦</span> 10:num/<span class="Special">raw</span> <span class="Special"><-</span> get *chan, <span class="Constant">first-free:offset</span> <span id="L228" class="LineNr">228 </span> <span class="Conceal">¦</span> 11:num/<span class="Special">raw</span> <span class="Special"><-</span> get *chan, <span class="Constant">first-free:offset</span> <span id="L229" class="LineNr">229 </span> <span class="Conceal">¦</span> <span class="Comment"># write second value, verify that first-free wraps</span> -<span id="L230" class="LineNr">230 </span> <span class="Conceal">¦</span> sink <span class="Special"><-</span> <a href='075channel.mu.html#L66'>write</a> sink,<span class="Constant"> 34</span> +<span id="L230" class="LineNr">230 </span> <span class="Conceal">¦</span> <a href='075channel.mu.html#L47'>sink</a> <span class="Special"><-</span> <a href='075channel.mu.html#L66'>write</a> <a href='075channel.mu.html#L47'>sink</a>,<span class="Constant"> 34</span> <span id="L231" class="LineNr">231 </span> <span class="Conceal">¦</span> 20:num/<span class="Special">raw</span> <span class="Special"><-</span> get *chan, <span class="Constant">first-free:offset</span> <span id="L232" class="LineNr">232 </span> <span class="Conceal">¦</span> <span class="Comment"># read second value, verify that first-full wraps</span> -<span id="L233" class="LineNr">233 </span> <span class="Conceal">¦</span> _, _, source <span class="Special"><-</span> read source +<span id="L233" class="LineNr">233 </span> <span class="Conceal">¦</span> _, _, <a href='075channel.mu.html#L43'>source</a> <span class="Special"><-</span> read <a href='075channel.mu.html#L43'>source</a> <span id="L234" class="LineNr">234 </span> <span class="Conceal">¦</span> 30:num/<span class="Special">raw</span> <span class="Special"><-</span> get *chan, <span class="Constant">first-full:offset</span> <span id="L235" class="LineNr">235 </span> ] <span id="L236" class="LineNr">236 </span> memory-should-contain [ @@ -308,7 +308,7 @@ if ('onhashchange' in window) { <span id="L244" class="LineNr">244 </span><span class="muScenario">scenario</span> channel-new-empty-not-full [ <span id="L245" class="LineNr">245 </span> run [ <span id="L246" class="LineNr">246 </span> <span class="Conceal">¦</span> <span class="Constant">local-scope</span> -<span id="L247" class="LineNr">247 </span> <span class="Conceal">¦</span> source:&:source:num <span class="Special"><-</span> <a href='075channel.mu.html#L51'>new-channel</a> <span class="Constant">3/capacity</span> +<span id="L247" class="LineNr">247 </span> <span class="Conceal">¦</span> <a href='075channel.mu.html#L43'>source</a>:&:<a href='075channel.mu.html#L43'>source</a>:num <span class="Special"><-</span> <a href='075channel.mu.html#L51'>new-channel</a> <span class="Constant">3/capacity</span> <span id="L248" class="LineNr">248 </span> <span class="Conceal">¦</span> chan:&:channel:num <span class="Special"><-</span> get *source, <span class="Constant">chan:offset</span> <span id="L249" class="LineNr">249 </span> <span class="Conceal">¦</span> 10:bool/<span class="Special">raw</span> <span class="Special"><-</span> <a href='075channel.mu.html#L350'>channel-empty?</a> chan <span id="L250" class="LineNr">250 </span> <span class="Conceal">¦</span> 11:bool/<span class="Special">raw</span> <span class="Special"><-</span> <a href='075channel.mu.html#L361'>channel-full?</a> chan @@ -321,10 +321,10 @@ if ('onhashchange' in window) { <span id="L257" class="LineNr">257 </span> <span id="L258" class="LineNr">258 </span><span class="muScenario">scenario</span> channel-write-not-empty [ <span id="L259" class="LineNr">259 </span> <span class="Constant">local-scope</span> -<span id="L260" class="LineNr">260 </span> source:&:source:num, sink:&:sink:num <span class="Special"><-</span> <a href='075channel.mu.html#L51'>new-channel</a> <span class="Constant">3/capacity</span> +<span id="L260" class="LineNr">260 </span> <a href='075channel.mu.html#L43'>source</a>:&:<a href='075channel.mu.html#L43'>source</a>:num, <a href='075channel.mu.html#L47'>sink</a>:&:<a href='075channel.mu.html#L47'>sink</a>:num <span class="Special"><-</span> <a href='075channel.mu.html#L51'>new-channel</a> <span class="Constant">3/capacity</span> <span id="L261" class="LineNr">261 </span> chan:&:channel:num <span class="Special"><-</span> get *source, <span class="Constant">chan:offset</span> <span id="L262" class="LineNr">262 </span> run [ -<span id="L263" class="LineNr">263 </span> <span class="Conceal">¦</span> sink <span class="Special"><-</span> <a href='075channel.mu.html#L66'>write</a> sink,<span class="Constant"> 34</span> +<span id="L263" class="LineNr">263 </span> <span class="Conceal">¦</span> <a href='075channel.mu.html#L47'>sink</a> <span class="Special"><-</span> <a href='075channel.mu.html#L66'>write</a> <a href='075channel.mu.html#L47'>sink</a>,<span class="Constant"> 34</span> <span id="L264" class="LineNr">264 </span> <span class="Conceal">¦</span> 10:bool/<span class="Special">raw</span> <span class="Special"><-</span> <a href='075channel.mu.html#L350'>channel-empty?</a> chan <span id="L265" class="LineNr">265 </span> <span class="Conceal">¦</span> 11:bool/<span class="Special">raw</span> <span class="Special"><-</span> <a href='075channel.mu.html#L361'>channel-full?</a> chan <span id="L266" class="LineNr">266 </span> ] @@ -336,10 +336,10 @@ if ('onhashchange' in window) { <span id="L272" class="LineNr">272 </span> <span id="L273" class="LineNr">273 </span><span class="muScenario">scenario</span> channel-write-full [ <span id="L274" class="LineNr">274 </span> <span class="Constant">local-scope</span> -<span id="L275" class="LineNr">275 </span> source:&:source:num, sink:&:sink:num <span class="Special"><-</span> <a href='075channel.mu.html#L51'>new-channel</a> <span class="Constant">1/capacity</span> +<span id="L275" class="LineNr">275 </span> <a href='075channel.mu.html#L43'>source</a>:&:<a href='075channel.mu.html#L43'>source</a>:num, <a href='075channel.mu.html#L47'>sink</a>:&:<a href='075channel.mu.html#L47'>sink</a>:num <span class="Special"><-</span> <a href='075channel.mu.html#L51'>new-channel</a> <span class="Constant">1/capacity</span> <span id="L276" class="LineNr">276 </span> chan:&:channel:num <span class="Special"><-</span> get *source, <span class="Constant">chan:offset</span> <span id="L277" class="LineNr">277 </span> run [ -<span id="L278" class="LineNr">278 </span> <span class="Conceal">¦</span> sink <span class="Special"><-</span> <a href='075channel.mu.html#L66'>write</a> sink,<span class="Constant"> 34</span> +<span id="L278" class="LineNr">278 </span> <span class="Conceal">¦</span> <a href='075channel.mu.html#L47'>sink</a> <span class="Special"><-</span> <a href='075channel.mu.html#L66'>write</a> <a href='075channel.mu.html#L47'>sink</a>,<span class="Constant"> 34</span> <span id="L279" class="LineNr">279 </span> <span class="Conceal">¦</span> 10:bool/<span class="Special">raw</span> <span class="Special"><-</span> <a href='075channel.mu.html#L350'>channel-empty?</a> chan <span id="L280" class="LineNr">280 </span> <span class="Conceal">¦</span> 11:bool/<span class="Special">raw</span> <span class="Special"><-</span> <a href='075channel.mu.html#L361'>channel-full?</a> chan <span id="L281" class="LineNr">281 </span> ] @@ -351,11 +351,11 @@ if ('onhashchange' in window) { <span id="L287" class="LineNr">287 </span> <span id="L288" class="LineNr">288 </span><span class="muScenario">scenario</span> channel-read-not-full [ <span id="L289" class="LineNr">289 </span> <span class="Constant">local-scope</span> -<span id="L290" class="LineNr">290 </span> source:&:source:num, sink:&:sink:num <span class="Special"><-</span> <a href='075channel.mu.html#L51'>new-channel</a> <span class="Constant">1/capacity</span> +<span id="L290" class="LineNr">290 </span> <a href='075channel.mu.html#L43'>source</a>:&:<a href='075channel.mu.html#L43'>source</a>:num, <a href='075channel.mu.html#L47'>sink</a>:&:<a href='075channel.mu.html#L47'>sink</a>:num <span class="Special"><-</span> <a href='075channel.mu.html#L51'>new-channel</a> <span class="Constant">1/capacity</span> <span id="L291" class="LineNr">291 </span> chan:&:channel:num <span class="Special"><-</span> get *source, <span class="Constant">chan:offset</span> -<span id="L292" class="LineNr">292 </span> sink <span class="Special"><-</span> <a href='075channel.mu.html#L66'>write</a> sink,<span class="Constant"> 34</span> +<span id="L292" class="LineNr">292 </span> <a href='075channel.mu.html#L47'>sink</a> <span class="Special"><-</span> <a href='075channel.mu.html#L66'>write</a> <a href='075channel.mu.html#L47'>sink</a>,<span class="Constant"> 34</span> <span id="L293" class="LineNr">293 </span> run [ -<span id="L294" class="LineNr">294 </span> <span class="Conceal">¦</span> _, _, source <span class="Special"><-</span> read source +<span id="L294" class="LineNr">294 </span> <span class="Conceal">¦</span> _, _, <a href='075channel.mu.html#L43'>source</a> <span class="Special"><-</span> read <a href='075channel.mu.html#L43'>source</a> <span id="L295" class="LineNr">295 </span> <span class="Conceal">¦</span> 10:bool/<span class="Special">raw</span> <span class="Special"><-</span> <a href='075channel.mu.html#L350'>channel-empty?</a> chan <span id="L296" class="LineNr">296 </span> <span class="Conceal">¦</span> 11:bool/<span class="Special">raw</span> <span class="Special"><-</span> <a href='075channel.mu.html#L361'>channel-full?</a> chan <span id="L297" class="LineNr">297 </span> ] @@ -375,13 +375,13 @@ if ('onhashchange' in window) { <span id="L311" class="LineNr">311 </span> <span id="L312" class="LineNr">312 </span><span class="Comment"># a channel can be closed from either the source or the sink</span> <span id="L313" class="LineNr">313 </span><span class="Comment"># both routines can modify the 'closed?' bit, but they can only ever set it, so this is a benign race</span> -<span id="L314" class="LineNr">314 </span><span class="muRecipe">def</span> close x:&:source:_elem<span class="muRecipe"> -> </span>x:&:source:_elem [ +<span id="L314" class="LineNr">314 </span><span class="muRecipe">def</span> close x:&:<a href='075channel.mu.html#L43'>source</a>:_elem<span class="muRecipe"> -> </span>x:&:<a href='075channel.mu.html#L43'>source</a>:_elem [ <span id="L315" class="LineNr">315 </span> <span class="Constant">local-scope</span> <span id="L316" class="LineNr">316 </span> <span class="Constant">load-ingredients</span> <span id="L317" class="LineNr">317 </span> chan:&:channel:_elem <span class="Special"><-</span> get *x, <span class="Constant">chan:offset</span> <span id="L318" class="LineNr">318 </span> *chan <span class="Special"><-</span> put *chan, <span class="Constant">closed?:offset</span>, <span class="Constant">1/true</span> <span id="L319" class="LineNr">319 </span>] -<span id="L320" class="LineNr">320 </span><span class="muRecipe">def</span> close x:&:sink:_elem<span class="muRecipe"> -> </span>x:&:sink:_elem [ +<span id="L320" class="LineNr">320 </span><span class="muRecipe">def</span> close x:&:<a href='075channel.mu.html#L47'>sink</a>:_elem<span class="muRecipe"> -> </span>x:&:<a href='075channel.mu.html#L47'>sink</a>:_elem [ <span id="L321" class="LineNr">321 </span> <span class="Constant">local-scope</span> <span id="L322" class="LineNr">322 </span> <span class="Constant">load-ingredients</span> <span id="L323" class="LineNr">323 </span> chan:&:channel:_elem <span class="Special"><-</span> get *x, <span class="Constant">chan:offset</span> @@ -449,13 +449,13 @@ if ('onhashchange' in window) { <span id="L385" class="LineNr">385 </span> <span id="L386" class="LineNr">386 </span><span class="SalientComment">## helpers for channels of characters in particular</span> <span id="L387" class="LineNr">387 </span> -<span id="L388" class="LineNr">388 </span><span class="muRecipe">def</span> <a href='075channel.mu.html#L388'>buffer-lines</a> in:&:source:char, buffered-out:&:sink:char<span class="muRecipe"> -> </span>buffered-out:&:sink:char, in:&:source:char [ +<span id="L388" class="LineNr">388 </span><span class="muRecipe">def</span> <a href='075channel.mu.html#L388'>buffer-lines</a> in:&:<a href='075channel.mu.html#L43'>source</a>:char, buffered-out:&:<a href='075channel.mu.html#L47'>sink</a>:char<span class="muRecipe"> -> </span>buffered-out:&:<a href='075channel.mu.html#L47'>sink</a>:char, in:&:<a href='075channel.mu.html#L43'>source</a>:char [ <span id="L389" class="LineNr">389 </span> <span class="Constant">local-scope</span> <span id="L390" class="LineNr">390 </span> <span class="Constant">load-ingredients</span> <span id="L391" class="LineNr">391 </span> <span class="Comment"># repeat forever</span> <span id="L392" class="LineNr">392 </span> eof?:bool <span class="Special"><-</span> copy <span class="Constant">0/false</span> <span id="L393" class="LineNr">393 </span> <span class="Delimiter">{</span> -<span id="L394" class="LineNr">394 </span> <span class="Conceal">¦</span> line:&:buffer:char <span class="Special"><-</span> <a href='061text.mu.html#L131'>new-buffer</a><span class="Constant"> 30</span> +<span id="L394" class="LineNr">394 </span> <span class="Conceal">¦</span> line:&:<a href='061text.mu.html#L126'>buffer</a>:char <span class="Special"><-</span> <a href='061text.mu.html#L131'>new-buffer</a><span class="Constant"> 30</span> <span id="L395" class="LineNr">395 </span> <span class="Conceal">¦</span> <span class="Comment"># read characters from 'in' until newline, copy into line</span> <span id="L396" class="LineNr">396 </span> <span class="Conceal">¦</span> <span class="Delimiter">{</span> <span id="L397" class="LineNr">397 </span><span class="Constant"> </span><span class="Conceal">¦</span><span class="Constant"> </span><span class="Conceal">¦</span><span class="Constant"> +next-character</span> @@ -507,34 +507,34 @@ if ('onhashchange' in window) { <span id="L443" class="LineNr">443 </span><span class="muScenario">scenario</span> buffer-lines-blocks-until-newline [ <span id="L444" class="LineNr">444 </span> run [ <span id="L445" class="LineNr">445 </span> <span class="Conceal">¦</span> <span class="Constant">local-scope</span> -<span id="L446" class="LineNr">446 </span> <span class="Conceal">¦</span> source:&:source:char, sink:&:sink:char <span class="Special"><-</span> <a href='075channel.mu.html#L51'>new-channel</a> <span class="Constant">10/capacity</span> -<span id="L447" class="LineNr">447 </span> <span class="Conceal">¦</span> _, buffered-stdin:&:sink:char/buffered-stdin <span class="Special"><-</span> <a href='075channel.mu.html#L51'>new-channel</a> <span class="Constant">10/capacity</span> +<span id="L446" class="LineNr">446 </span> <span class="Conceal">¦</span> <a href='075channel.mu.html#L43'>source</a>:&:<a href='075channel.mu.html#L43'>source</a>:char, <a href='075channel.mu.html#L47'>sink</a>:&:<a href='075channel.mu.html#L47'>sink</a>:char <span class="Special"><-</span> <a href='075channel.mu.html#L51'>new-channel</a> <span class="Constant">10/capacity</span> +<span id="L447" class="LineNr">447 </span> <span class="Conceal">¦</span> _, buffered-stdin:&:<a href='075channel.mu.html#L47'>sink</a>:char/buffered-stdin <span class="Special"><-</span> <a href='075channel.mu.html#L51'>new-channel</a> <span class="Constant">10/capacity</span> <span id="L448" class="LineNr">448 </span> <span class="Conceal">¦</span> buffered-chan:&:channel:char <span class="Special"><-</span> get *buffered-stdin, <span class="Constant">chan:offset</span> <span id="L449" class="LineNr">449 </span> <span class="Conceal">¦</span> empty?:bool <span class="Special"><-</span> <a href='075channel.mu.html#L350'>channel-empty?</a> buffered-chan <span id="L450" class="LineNr">450 </span> <span class="Conceal">¦</span> assert empty?, <span class="Constant">[ </span> <span id="L451" class="LineNr">451 </span><span class="Constant">F buffer-lines-blocks-until-newline: channel should be empty after init]</span> <span id="L452" class="LineNr">452 </span> <span class="Conceal">¦</span> <span class="Comment"># buffer stdin into buffered-stdin, try to read from buffered-stdin</span> -<span id="L453" class="LineNr">453 </span> <span class="Conceal">¦</span> buffer-routine:num <span class="Special"><-</span> start-running <a href='075channel.mu.html#L388'>buffer-lines</a>, source, buffered-stdin +<span id="L453" class="LineNr">453 </span> <span class="Conceal">¦</span> buffer-routine:num <span class="Special"><-</span> start-running <a href='075channel.mu.html#L388'>buffer-lines</a>, <a href='075channel.mu.html#L43'>source</a>, buffered-stdin <span id="L454" class="LineNr">454 </span> <span class="Conceal">¦</span> wait-for-routine-to-block buffer-routine <span id="L455" class="LineNr">455 </span> <span class="Conceal">¦</span> empty? <span class="Special"><-</span> <a href='075channel.mu.html#L350'>channel-empty?</a> buffered-chan <span id="L456" class="LineNr">456 </span> <span class="Conceal">¦</span> assert empty?:bool, <span class="Constant">[ </span> <span id="L457" class="LineNr">457 </span><span class="Constant">F buffer-lines-blocks-until-newline: channel should be empty after <a href='075channel.mu.html#L388'>buffer-lines</a> bring-up]</span> <span id="L458" class="LineNr">458 </span> <span class="Conceal">¦</span> <span class="Comment"># write 'a'</span> -<span id="L459" class="LineNr">459 </span> <span class="Conceal">¦</span> sink <span class="Special"><-</span> <a href='075channel.mu.html#L66'>write</a> sink, <span class="Constant">97/a</span> +<span id="L459" class="LineNr">459 </span> <span class="Conceal">¦</span> <a href='075channel.mu.html#L47'>sink</a> <span class="Special"><-</span> <a href='075channel.mu.html#L66'>write</a> <a href='075channel.mu.html#L47'>sink</a>, <span class="Constant">97/a</span> <span id="L460" class="LineNr">460 </span> <span class="Conceal">¦</span> restart buffer-routine <span id="L461" class="LineNr">461 </span> <span class="Conceal">¦</span> wait-for-routine-to-block buffer-routine <span id="L462" class="LineNr">462 </span> <span class="Conceal">¦</span> empty? <span class="Special"><-</span> <a href='075channel.mu.html#L350'>channel-empty?</a> buffered-chan <span id="L463" class="LineNr">463 </span> <span class="Conceal">¦</span> assert empty?:bool, <span class="Constant">[ </span> <span id="L464" class="LineNr">464 </span><span class="Constant">F buffer-lines-blocks-until-newline: channel should be empty after writing 'a']</span> <span id="L465" class="LineNr">465 </span> <span class="Conceal">¦</span> <span class="Comment"># write 'b'</span> -<span id="L466" class="LineNr">466 </span> <span class="Conceal">¦</span> sink <span class="Special"><-</span> <a href='075channel.mu.html#L66'>write</a> sink, <span class="Constant">98/b</span> +<span id="L466" class="LineNr">466 </span> <span class="Conceal">¦</span> <a href='075channel.mu.html#L47'>sink</a> <span class="Special"><-</span> <a href='075channel.mu.html#L66'>write</a> <a href='075channel.mu.html#L47'>sink</a>, <span class="Constant">98/b</span> <span id="L467" class="LineNr">467 </span> <span class="Conceal">¦</span> restart buffer-routine <span id="L468" class="LineNr">468 </span> <span class="Conceal">¦</span> wait-for-routine-to-block buffer-routine <span id="L469" class="LineNr">469 </span> <span class="Conceal">¦</span> empty? <span class="Special"><-</span> <a href='075channel.mu.html#L350'>channel-empty?</a> buffered-chan <span id="L470" class="LineNr">470 </span> <span class="Conceal">¦</span> assert empty?:bool, <span class="Constant">[ </span> <span id="L471" class="LineNr">471 </span><span class="Constant">F buffer-lines-blocks-until-newline: channel should be empty after writing 'b']</span> <span id="L472" class="LineNr">472 </span> <span class="Conceal">¦</span> <span class="Comment"># write newline</span> -<span id="L473" class="LineNr">473 </span> <span class="Conceal">¦</span> sink <span class="Special"><-</span> <a href='075channel.mu.html#L66'>write</a> sink, <span class="Constant">10/newline</span> +<span id="L473" class="LineNr">473 </span> <span class="Conceal">¦</span> <a href='075channel.mu.html#L47'>sink</a> <span class="Special"><-</span> <a href='075channel.mu.html#L66'>write</a> <a href='075channel.mu.html#L47'>sink</a>, <span class="Constant">10/newline</span> <span id="L474" class="LineNr">474 </span> <span class="Conceal">¦</span> restart buffer-routine <span id="L475" class="LineNr">475 </span> <span class="Conceal">¦</span> wait-for-routine-to-block buffer-routine <span id="L476" class="LineNr">476 </span> <span class="Conceal">¦</span> empty? <span class="Special"><-</span> <a href='075channel.mu.html#L350'>channel-empty?</a> buffered-chan @@ -548,12 +548,12 @@ if ('onhashchange' in window) { <span id="L484" class="LineNr">484 </span> ] <span id="L485" class="LineNr">485 </span>] <span id="L486" class="LineNr">486 </span> -<span id="L487" class="LineNr">487 </span><span class="muRecipe">def</span> <a href='075channel.mu.html#L487'>drain</a> source:&:source:char<span class="muRecipe"> -> </span>result:text, source:&:source:char [ +<span id="L487" class="LineNr">487 </span><span class="muRecipe">def</span> <a href='075channel.mu.html#L487'>drain</a> <a href='075channel.mu.html#L43'>source</a>:&:<a href='075channel.mu.html#L43'>source</a>:char<span class="muRecipe"> -> </span>result:text, <a href='075channel.mu.html#L43'>source</a>:&:<a href='075channel.mu.html#L43'>source</a>:char [ <span id="L488" class="LineNr">488 </span> <span class="Constant">local-scope</span> <span id="L489" class="LineNr">489 </span> <span class="Constant">load-ingredients</span> -<span id="L490" class="LineNr">490 </span> buf:&:buffer:char <span class="Special"><-</span> <a href='061text.mu.html#L131'>new-buffer</a><span class="Constant"> 30</span> +<span id="L490" class="LineNr">490 </span> buf:&:<a href='061text.mu.html#L126'>buffer</a>:char <span class="Special"><-</span> <a href='061text.mu.html#L131'>new-buffer</a><span class="Constant"> 30</span> <span id="L491" class="LineNr">491 </span> <span class="Delimiter">{</span> -<span id="L492" class="LineNr">492 </span> <span class="Conceal">¦</span> c:char, done?:bool <span class="Special"><-</span> read source +<span id="L492" class="LineNr">492 </span> <span class="Conceal">¦</span> c:char, done?:bool <span class="Special"><-</span> read <a href='075channel.mu.html#L43'>source</a> <span id="L493" class="LineNr">493 </span> <span class="Conceal">¦</span> <span class="muControl">break-if</span> done? <span id="L494" class="LineNr">494 </span> <span class="Conceal">¦</span> buf <span class="Special"><-</span> append buf, c <span id="L495" class="LineNr">495 </span> <span class="Conceal">¦</span> <span class="muControl">loop</span> diff --git a/html/084console.mu.html b/html/084console.mu.html index 49937f4c..16712057 100644 --- a/html/084console.mu.html +++ b/html/084console.mu.html @@ -131,7 +131,7 @@ if ('onhashchange' in window) { <span id="L70" class="LineNr"> 70 </span> <span class="muControl">return</span> c, <span class="Constant">1/found</span>, <span class="Constant">0/quit</span> <span id="L71" class="LineNr"> 71 </span>] <span id="L72" class="LineNr"> 72 </span> -<span id="L73" class="LineNr"> 73 </span><span class="muRecipe">def</span> <a href='084console.mu.html#L73'>send-keys-to-channel</a> <a href='084console.mu.html#L23'>console</a>:&:<a href='084console.mu.html#L23'>console</a>, chan:&:sink:char, <a href='081print.mu.html#L4'>screen</a>:&:<a href='081print.mu.html#L4'>screen</a><span class="muRecipe"> -> </span><a href='084console.mu.html#L23'>console</a>:&:<a href='084console.mu.html#L23'>console</a>, chan:&:sink:char, <a href='081print.mu.html#L4'>screen</a>:&:<a href='081print.mu.html#L4'>screen</a> [ +<span id="L73" class="LineNr"> 73 </span><span class="muRecipe">def</span> <a href='084console.mu.html#L73'>send-keys-to-channel</a> <a href='084console.mu.html#L23'>console</a>:&:<a href='084console.mu.html#L23'>console</a>, chan:&:<a href='075channel.mu.html#L47'>sink</a>:char, <a href='081print.mu.html#L4'>screen</a>:&:<a href='081print.mu.html#L4'>screen</a><span class="muRecipe"> -> </span><a href='084console.mu.html#L23'>console</a>:&:<a href='084console.mu.html#L23'>console</a>, chan:&:<a href='075channel.mu.html#L47'>sink</a>:char, <a href='081print.mu.html#L4'>screen</a>:&:<a href='081print.mu.html#L4'>screen</a> [ <span id="L74" class="LineNr"> 74 </span> <span class="Constant">local-scope</span> <span id="L75" class="LineNr"> 75 </span> <span class="Constant">load-ingredients</span> <span id="L76" class="LineNr"> 76 </span> <span class="Delimiter">{</span> diff --git a/html/088file.mu.html b/html/088file.mu.html index 794e9592..42c94671 100644 --- a/html/088file.mu.html +++ b/html/088file.mu.html @@ -79,7 +79,7 @@ if ('onhashchange' in window) { <span id="L18" class="LineNr"> 18 </span> contents:text <span id="L19" class="LineNr"> 19 </span>] <span id="L20" class="LineNr"> 20 </span> -<span id="L21" class="LineNr"> 21 </span><span class="muRecipe">def</span> <a href='088file.mu.html#L21'>start-reading</a> <a href='088file.mu.html#L11'>resources</a>:&:<a href='088file.mu.html#L11'>resources</a>, filename:text<span class="muRecipe"> -> </span>contents:&:source:char, error?:bool [ +<span id="L21" class="LineNr"> 21 </span><span class="muRecipe">def</span> <a href='088file.mu.html#L21'>start-reading</a> <a href='088file.mu.html#L11'>resources</a>:&:<a href='088file.mu.html#L11'>resources</a>, filename:text<span class="muRecipe"> -> </span>contents:&:<a href='075channel.mu.html#L43'>source</a>:char, error?:bool [ <span id="L22" class="LineNr"> 22 </span> <span class="Constant">local-scope</span> <span id="L23" class="LineNr"> 23 </span> <span class="Constant">load-ingredients</span> <span id="L24" class="LineNr"> 24 </span> error? <span class="Special"><-</span> copy <span class="Constant">0/false</span> @@ -92,18 +92,18 @@ if ('onhashchange' in window) { <span id="L31" class="LineNr"> 31 </span> <span class="Comment"># real file system</span> <span id="L32" class="LineNr"> 32 </span> file:num <span class="Special"><-</span> $open-file-for-reading filename <span id="L33" class="LineNr"> 33 </span> <span class="muControl">return-unless</span> file, <span class="Constant">0/contents</span>, <span class="Constant">1/error?</span> -<span id="L34" class="LineNr"> 34 </span> contents:&:source:char, sink:&:sink:char <span class="Special"><-</span> <a href='075channel.mu.html#L51'>new-channel</a><span class="Constant"> 30</span> -<span id="L35" class="LineNr"> 35 </span> start-running <a href='088file.mu.html#L76'>receive-from-file</a> file, sink +<span id="L34" class="LineNr"> 34 </span> contents:&:<a href='075channel.mu.html#L43'>source</a>:char, <a href='075channel.mu.html#L47'>sink</a>:&:<a href='075channel.mu.html#L47'>sink</a>:char <span class="Special"><-</span> <a href='075channel.mu.html#L51'>new-channel</a><span class="Constant"> 30</span> +<span id="L35" class="LineNr"> 35 </span> start-running <a href='088file.mu.html#L76'>receive-from-file</a> file, <a href='075channel.mu.html#L47'>sink</a> <span id="L36" class="LineNr"> 36 </span>] <span id="L37" class="LineNr"> 37 </span> <span id="L38" class="LineNr"> 38 </span><span class="muRecipe">def</span> <a href='088file.mu.html#L38'>slurp</a> <a href='088file.mu.html#L11'>resources</a>:&:<a href='088file.mu.html#L11'>resources</a>, filename:text<span class="muRecipe"> -> </span>contents:text, error?:bool [ <span id="L39" class="LineNr"> 39 </span> <span class="Constant">local-scope</span> <span id="L40" class="LineNr"> 40 </span> <span class="Constant">load-ingredients</span> -<span id="L41" class="LineNr"> 41 </span> source:&:source:char, error?:bool <span class="Special"><-</span> <a href='088file.mu.html#L21'>start-reading</a> <a href='088file.mu.html#L11'>resources</a>, filename +<span id="L41" class="LineNr"> 41 </span> <a href='075channel.mu.html#L43'>source</a>:&:<a href='075channel.mu.html#L43'>source</a>:char, error?:bool <span class="Special"><-</span> <a href='088file.mu.html#L21'>start-reading</a> <a href='088file.mu.html#L11'>resources</a>, filename <span id="L42" class="LineNr"> 42 </span> <span class="muControl">return-if</span> error?, <span class="Constant">0/contents</span> -<span id="L43" class="LineNr"> 43 </span> buf:&:buffer:char <span class="Special"><-</span> <a href='061text.mu.html#L131'>new-buffer</a> <span class="Constant">30/capacity</span> +<span id="L43" class="LineNr"> 43 </span> buf:&:<a href='061text.mu.html#L126'>buffer</a>:char <span class="Special"><-</span> <a href='061text.mu.html#L131'>new-buffer</a> <span class="Constant">30/capacity</span> <span id="L44" class="LineNr"> 44 </span> <span class="Delimiter">{</span> -<span id="L45" class="LineNr"> 45 </span> <span class="Conceal">¦</span> c:char, done?:bool, source <span class="Special"><-</span> read source +<span id="L45" class="LineNr"> 45 </span> <span class="Conceal">¦</span> c:char, done?:bool, <a href='075channel.mu.html#L43'>source</a> <span class="Special"><-</span> read <a href='075channel.mu.html#L43'>source</a> <span id="L46" class="LineNr"> 46 </span> <span class="Conceal">¦</span> <span class="muControl">break-if</span> done? <span id="L47" class="LineNr"> 47 </span> <span class="Conceal">¦</span> buf <span class="Special"><-</span> append buf, c <span id="L48" class="LineNr"> 48 </span> <span class="Conceal">¦</span> <span class="muControl">loop</span> @@ -111,7 +111,7 @@ if ('onhashchange' in window) { <span id="L50" class="LineNr"> 50 </span> contents <span class="Special"><-</span> <a href='061text.mu.html#L328'>buffer-to-array</a> buf <span id="L51" class="LineNr"> 51 </span>] <span id="L52" class="LineNr"> 52 </span> -<span id="L53" class="LineNr"> 53 </span><span class="muRecipe">def</span> <a href='088file.mu.html#L53'>start-reading-from-fake-resource</a> <a href='088file.mu.html#L11'>resources</a>:&:<a href='088file.mu.html#L11'>resources</a>, <a href='088file.mu.html#L16'>resource</a>:text<span class="muRecipe"> -> </span>contents:&:source:char, error?:bool [ +<span id="L53" class="LineNr"> 53 </span><span class="muRecipe">def</span> <a href='088file.mu.html#L53'>start-reading-from-fake-resource</a> <a href='088file.mu.html#L11'>resources</a>:&:<a href='088file.mu.html#L11'>resources</a>, <a href='088file.mu.html#L16'>resource</a>:text<span class="muRecipe"> -> </span>contents:&:<a href='075channel.mu.html#L43'>source</a>:char, error?:bool [ <span id="L54" class="LineNr"> 54 </span> <span class="Constant">local-scope</span> <span id="L55" class="LineNr"> 55 </span> <span class="Constant">load-ingredients</span> <span id="L56" class="LineNr"> 56 </span> error? <span class="Special"><-</span> copy <span class="Constant">0/no-error</span> @@ -126,28 +126,28 @@ if ('onhashchange' in window) { <span id="L65" class="LineNr"> 65 </span> <span class="Conceal">¦</span> curr-resource:text <span class="Special"><-</span> get tmp, <span class="Constant">name:offset</span> <span id="L66" class="LineNr"> 66 </span> <span class="Conceal">¦</span> found?:bool <span class="Special"><-</span> equal <a href='088file.mu.html#L16'>resource</a>, curr-resource <span id="L67" class="LineNr"> 67 </span> <span class="Conceal">¦</span> <span class="muControl">loop-unless</span> found? -<span id="L68" class="LineNr"> 68 </span> <span class="Conceal">¦</span> contents:&:source:char, sink:&:sink:char <span class="Special"><-</span> <a href='075channel.mu.html#L51'>new-channel</a><span class="Constant"> 30</span> +<span id="L68" class="LineNr"> 68 </span> <span class="Conceal">¦</span> contents:&:<a href='075channel.mu.html#L43'>source</a>:char, <a href='075channel.mu.html#L47'>sink</a>:&:<a href='075channel.mu.html#L47'>sink</a>:char <span class="Special"><-</span> <a href='075channel.mu.html#L51'>new-channel</a><span class="Constant"> 30</span> <span id="L69" class="LineNr"> 69 </span> <span class="Conceal">¦</span> curr-contents:text <span class="Special"><-</span> get tmp, <span class="Constant">contents:offset</span> -<span id="L70" class="LineNr"> 70 </span> <span class="Conceal">¦</span> start-running <a href='088file.mu.html#L89'>receive-from-text</a> curr-contents, sink +<span id="L70" class="LineNr"> 70 </span> <span class="Conceal">¦</span> start-running <a href='088file.mu.html#L89'>receive-from-text</a> curr-contents, <a href='075channel.mu.html#L47'>sink</a> <span id="L71" class="LineNr"> 71 </span> <span class="Conceal">¦</span> <span class="muControl">return</span> <span id="L72" class="LineNr"> 72 </span> <span class="Delimiter">}</span> <span id="L73" class="LineNr"> 73 </span> <span class="muControl">return</span> <span class="Constant">0/not-found</span>, <span class="Constant">1/error</span> <span id="L74" class="LineNr"> 74 </span>] <span id="L75" class="LineNr"> 75 </span> -<span id="L76" class="LineNr"> 76 </span><span class="muRecipe">def</span> <a href='088file.mu.html#L76'>receive-from-file</a> file:num, sink:&:sink:char<span class="muRecipe"> -> </span>sink:&:sink:char [ +<span id="L76" class="LineNr"> 76 </span><span class="muRecipe">def</span> <a href='088file.mu.html#L76'>receive-from-file</a> file:num, <a href='075channel.mu.html#L47'>sink</a>:&:<a href='075channel.mu.html#L47'>sink</a>:char<span class="muRecipe"> -> </span><a href='075channel.mu.html#L47'>sink</a>:&:<a href='075channel.mu.html#L47'>sink</a>:char [ <span id="L77" class="LineNr"> 77 </span> <span class="Constant">local-scope</span> <span id="L78" class="LineNr"> 78 </span> <span class="Constant">load-ingredients</span> <span id="L79" class="LineNr"> 79 </span> <span class="Delimiter">{</span> <span id="L80" class="LineNr"> 80 </span> <span class="Conceal">¦</span> c:char, eof?:bool <span class="Special"><-</span> $read-from-file file <span id="L81" class="LineNr"> 81 </span> <span class="Conceal">¦</span> <span class="muControl">break-if</span> eof? -<span id="L82" class="LineNr"> 82 </span> <span class="Conceal">¦</span> sink <span class="Special"><-</span> <a href='075channel.mu.html#L66'>write</a> sink, c +<span id="L82" class="LineNr"> 82 </span> <span class="Conceal">¦</span> <a href='075channel.mu.html#L47'>sink</a> <span class="Special"><-</span> <a href='075channel.mu.html#L66'>write</a> <a href='075channel.mu.html#L47'>sink</a>, c <span id="L83" class="LineNr"> 83 </span> <span class="Conceal">¦</span> <span class="muControl">loop</span> <span id="L84" class="LineNr"> 84 </span> <span class="Delimiter">}</span> -<span id="L85" class="LineNr"> 85 </span> sink <span class="Special"><-</span> close sink +<span id="L85" class="LineNr"> 85 </span> <a href='075channel.mu.html#L47'>sink</a> <span class="Special"><-</span> close <a href='075channel.mu.html#L47'>sink</a> <span id="L86" class="LineNr"> 86 </span> file <span class="Special"><-</span> $close-file file <span id="L87" class="LineNr"> 87 </span>] <span id="L88" class="LineNr"> 88 </span> -<span id="L89" class="LineNr"> 89 </span><span class="muRecipe">def</span> <a href='088file.mu.html#L89'>receive-from-text</a> contents:text, sink:&:sink:char<span class="muRecipe"> -> </span>sink:&:sink:char [ +<span id="L89" class="LineNr"> 89 </span><span class="muRecipe">def</span> <a href='088file.mu.html#L89'>receive-from-text</a> contents:text, <a href='075channel.mu.html#L47'>sink</a>:&:<a href='075channel.mu.html#L47'>sink</a>:char<span class="muRecipe"> -> </span><a href='075channel.mu.html#L47'>sink</a>:&:<a href='075channel.mu.html#L47'>sink</a>:char [ <span id="L90" class="LineNr"> 90 </span> <span class="Constant">local-scope</span> <span id="L91" class="LineNr"> 91 </span> <span class="Constant">load-ingredients</span> <span id="L92" class="LineNr"> 92 </span> i:num <span class="Special"><-</span> copy<span class="Constant"> 0</span> @@ -156,22 +156,22 @@ if ('onhashchange' in window) { <span id="L95" class="LineNr"> 95 </span> <span class="Conceal">¦</span> done?:bool <span class="Special"><-</span> greater-or-equal i, len <span id="L96" class="LineNr"> 96 </span> <span class="Conceal">¦</span> <span class="muControl">break-if</span> done? <span id="L97" class="LineNr"> 97 </span> <span class="Conceal">¦</span> c:char <span class="Special"><-</span> index *contents, i -<span id="L98" class="LineNr"> 98 </span> <span class="Conceal">¦</span> sink <span class="Special"><-</span> <a href='075channel.mu.html#L66'>write</a> sink, c +<span id="L98" class="LineNr"> 98 </span> <span class="Conceal">¦</span> <a href='075channel.mu.html#L47'>sink</a> <span class="Special"><-</span> <a href='075channel.mu.html#L66'>write</a> <a href='075channel.mu.html#L47'>sink</a>, c <span id="L99" class="LineNr"> 99 </span> <span class="Conceal">¦</span> i <span class="Special"><-</span> add i,<span class="Constant"> 1</span> <span id="L100" class="LineNr">100 </span> <span class="Conceal">¦</span> <span class="muControl">loop</span> <span id="L101" class="LineNr">101 </span> <span class="Delimiter">}</span> -<span id="L102" class="LineNr">102 </span> sink <span class="Special"><-</span> close sink +<span id="L102" class="LineNr">102 </span> <a href='075channel.mu.html#L47'>sink</a> <span class="Special"><-</span> close <a href='075channel.mu.html#L47'>sink</a> <span id="L103" class="LineNr">103 </span>] <span id="L104" class="LineNr">104 </span> -<span id="L105" class="LineNr">105 </span><span class="muRecipe">def</span> <a href='088file.mu.html#L105'>start-writing</a> <a href='088file.mu.html#L11'>resources</a>:&:<a href='088file.mu.html#L11'>resources</a>, filename:text<span class="muRecipe"> -> </span>sink:&:sink:char, routine-id:num, error?:bool [ +<span id="L105" class="LineNr">105 </span><span class="muRecipe">def</span> <a href='088file.mu.html#L105'>start-writing</a> <a href='088file.mu.html#L11'>resources</a>:&:<a href='088file.mu.html#L11'>resources</a>, filename:text<span class="muRecipe"> -> </span><a href='075channel.mu.html#L47'>sink</a>:&:<a href='075channel.mu.html#L47'>sink</a>:char, routine-id:num, error?:bool [ <span id="L106" class="LineNr">106 </span> <span class="Constant">local-scope</span> <span id="L107" class="LineNr">107 </span> <span class="Constant">load-ingredients</span> <span id="L108" class="LineNr">108 </span> error? <span class="Special"><-</span> copy <span class="Constant">0/false</span> -<span id="L109" class="LineNr">109 </span> source:&:source:char, sink:&:sink:char <span class="Special"><-</span> <a href='075channel.mu.html#L51'>new-channel</a><span class="Constant"> 30</span> +<span id="L109" class="LineNr">109 </span> <a href='075channel.mu.html#L43'>source</a>:&:<a href='075channel.mu.html#L43'>source</a>:char, <a href='075channel.mu.html#L47'>sink</a>:&:<a href='075channel.mu.html#L47'>sink</a>:char <span class="Special"><-</span> <a href='075channel.mu.html#L51'>new-channel</a><span class="Constant"> 30</span> <span id="L110" class="LineNr">110 </span> <span class="Delimiter">{</span> <span id="L111" class="LineNr">111 </span> <span class="Conceal">¦</span> <span class="muControl">break-unless</span> <a href='088file.mu.html#L11'>resources</a> <span id="L112" class="LineNr">112 </span> <span class="Conceal">¦</span> <span class="Comment"># fake file system</span> -<span id="L113" class="LineNr">113 </span> <span class="Conceal">¦</span> routine-id <span class="Special"><-</span> start-running <a href='088file.mu.html#L162'>transmit-to-fake-resource</a> <a href='088file.mu.html#L11'>resources</a>, filename, source +<span id="L113" class="LineNr">113 </span> <span class="Conceal">¦</span> routine-id <span class="Special"><-</span> start-running <a href='088file.mu.html#L162'>transmit-to-fake-resource</a> <a href='088file.mu.html#L11'>resources</a>, filename, <a href='075channel.mu.html#L43'>source</a> <span id="L114" class="LineNr">114 </span> <span class="Conceal">¦</span> <span class="muControl">return</span> <span id="L115" class="LineNr">115 </span> <span class="Delimiter">}</span> <span id="L116" class="LineNr">116 </span> <span class="Comment"># real file system</span> @@ -182,7 +182,7 @@ if ('onhashchange' in window) { <span id="L121" class="LineNr">121 </span> <span class="Conceal">¦</span> msg:text <span class="Special"><-</span> append <span class="Constant">[no such file: ]</span> filename <span id="L122" class="LineNr">122 </span> <span class="Conceal">¦</span> assert file, msg <span id="L123" class="LineNr">123 </span> <span class="Delimiter">}</span> -<span id="L124" class="LineNr">124 </span> routine-id <span class="Special"><-</span> start-running <a href='088file.mu.html#L150'>transmit-to-file</a> file, source +<span id="L124" class="LineNr">124 </span> routine-id <span class="Special"><-</span> start-running <a href='088file.mu.html#L150'>transmit-to-file</a> file, <a href='075channel.mu.html#L43'>source</a> <span id="L125" class="LineNr">125 </span>] <span id="L126" class="LineNr">126 </span> <span id="L127" class="LineNr">127 </span><span class="muRecipe">def</span> <a href='088file.mu.html#L127'>dump</a> <a href='088file.mu.html#L11'>resources</a>:&:<a href='088file.mu.html#L11'>resources</a>, filename:text, contents:text<span class="muRecipe"> -> </span><a href='088file.mu.html#L11'>resources</a>:&:<a href='088file.mu.html#L11'>resources</a>, error?:bool [ @@ -190,7 +190,7 @@ if ('onhashchange' in window) { <span id="L129" class="LineNr">129 </span> <span class="Constant">load-ingredients</span> <span id="L130" class="LineNr">130 </span> <span class="Comment"># todo: really create an empty file</span> <span id="L131" class="LineNr">131 </span> <span class="muControl">return-unless</span> contents, <a href='088file.mu.html#L11'>resources</a>, <span class="Constant">0/no-error</span> -<span id="L132" class="LineNr">132 </span> sink-file:&:sink:char, write-routine:num, error?:bool <span class="Special"><-</span> <a href='088file.mu.html#L105'>start-writing</a> <a href='088file.mu.html#L11'>resources</a>, filename +<span id="L132" class="LineNr">132 </span> sink-file:&:<a href='075channel.mu.html#L47'>sink</a>:char, write-routine:num, error?:bool <span class="Special"><-</span> <a href='088file.mu.html#L105'>start-writing</a> <a href='088file.mu.html#L11'>resources</a>, filename <span id="L133" class="LineNr">133 </span> <span class="muControl">return-if</span> error? <span id="L134" class="LineNr">134 </span> i:num <span class="Special"><-</span> copy<span class="Constant"> 0</span> <span id="L135" class="LineNr">135 </span> len:num <span class="Special"><-</span> length *contents @@ -208,11 +208,11 @@ if ('onhashchange' in window) { <span id="L147" class="LineNr">147 </span> wait-for-routine write-routine <span id="L148" class="LineNr">148 </span>] <span id="L149" class="LineNr">149 </span> -<span id="L150" class="LineNr">150 </span><span class="muRecipe">def</span> <a href='088file.mu.html#L150'>transmit-to-file</a> file:num, source:&:source:char<span class="muRecipe"> -> </span>source:&:source:char [ +<span id="L150" class="LineNr">150 </span><span class="muRecipe">def</span> <a href='088file.mu.html#L150'>transmit-to-file</a> file:num, <a href='075channel.mu.html#L43'>source</a>:&:<a href='075channel.mu.html#L43'>source</a>:char<span class="muRecipe"> -> </span><a href='075channel.mu.html#L43'>source</a>:&:<a href='075channel.mu.html#L43'>source</a>:char [ <span id="L151" class="LineNr">151 </span> <span class="Constant">local-scope</span> <span id="L152" class="LineNr">152 </span> <span class="Constant">load-ingredients</span> <span id="L153" class="LineNr">153 </span> <span class="Delimiter">{</span> -<span id="L154" class="LineNr">154 </span> <span class="Conceal">¦</span> c:char, done?:bool, source <span class="Special"><-</span> read source +<span id="L154" class="LineNr">154 </span> <span class="Conceal">¦</span> c:char, done?:bool, <a href='075channel.mu.html#L43'>source</a> <span class="Special"><-</span> read <a href='075channel.mu.html#L43'>source</a> <span id="L155" class="LineNr">155 </span> <span class="Conceal">¦</span> <span class="muControl">break-if</span> done? <span id="L156" class="LineNr">156 </span> <span class="Conceal">¦</span> $write-to-file file, c <span id="L157" class="LineNr">157 </span> <span class="Conceal">¦</span> <span class="muControl">loop</span> @@ -220,15 +220,15 @@ if ('onhashchange' in window) { <span id="L159" class="LineNr">159 </span> file <span class="Special"><-</span> $close-file file <span id="L160" class="LineNr">160 </span>] <span id="L161" class="LineNr">161 </span> -<span id="L162" class="LineNr">162 </span><span class="muRecipe">def</span> <a href='088file.mu.html#L162'>transmit-to-fake-resource</a> <a href='088file.mu.html#L11'>resources</a>:&:<a href='088file.mu.html#L11'>resources</a>, filename:text, source:&:source:char<span class="muRecipe"> -> </span><a href='088file.mu.html#L11'>resources</a>:&:<a href='088file.mu.html#L11'>resources</a>, source:&:source:char [ +<span id="L162" class="LineNr">162 </span><span class="muRecipe">def</span> <a href='088file.mu.html#L162'>transmit-to-fake-resource</a> <a href='088file.mu.html#L11'>resources</a>:&:<a href='088file.mu.html#L11'>resources</a>, filename:text, <a href='075channel.mu.html#L43'>source</a>:&:<a href='075channel.mu.html#L43'>source</a>:char<span class="muRecipe"> -> </span><a href='088file.mu.html#L11'>resources</a>:&:<a href='088file.mu.html#L11'>resources</a>, <a href='075channel.mu.html#L43'>source</a>:&:<a href='075channel.mu.html#L43'>source</a>:char [ <span id="L163" class="LineNr">163 </span> <span class="Constant">local-scope</span> <span id="L164" class="LineNr">164 </span> <span class="Constant">load-ingredients</span> <span id="L165" class="LineNr">165 </span> lock:location <span class="Special"><-</span> get-location *resources, <span class="Constant">lock:offset</span> <span id="L166" class="LineNr">166 </span> wait-for-reset-then-set lock <span id="L167" class="LineNr">167 </span> <span class="Comment"># compute new file contents</span> -<span id="L168" class="LineNr">168 </span> buf:&:buffer:char <span class="Special"><-</span> <a href='061text.mu.html#L131'>new-buffer</a><span class="Constant"> 30</span> +<span id="L168" class="LineNr">168 </span> buf:&:<a href='061text.mu.html#L126'>buffer</a>:char <span class="Special"><-</span> <a href='061text.mu.html#L131'>new-buffer</a><span class="Constant"> 30</span> <span id="L169" class="LineNr">169 </span> <span class="Delimiter">{</span> -<span id="L170" class="LineNr">170 </span> <span class="Conceal">¦</span> c:char, done?:bool, source <span class="Special"><-</span> read source +<span id="L170" class="LineNr">170 </span> <span class="Conceal">¦</span> c:char, done?:bool, <a href='075channel.mu.html#L43'>source</a> <span class="Special"><-</span> read <a href='075channel.mu.html#L43'>source</a> <span id="L171" class="LineNr">171 </span> <span class="Conceal">¦</span> <span class="muControl">break-if</span> done? <span id="L172" class="LineNr">172 </span> <span class="Conceal">¦</span> buf <span class="Special"><-</span> append buf, c <span id="L173" class="LineNr">173 </span> <span class="Conceal">¦</span> <span class="muControl">loop</span> diff --git a/html/090scenario_filesystem_test.mu.html b/html/090scenario_filesystem_test.mu.html index 1fb26361..43f6a5e8 100644 --- a/html/090scenario_filesystem_test.mu.html +++ b/html/090scenario_filesystem_test.mu.html @@ -65,7 +65,7 @@ if ('onhashchange' in window) { <span id="L7" class="LineNr"> 7 </span><span class="Constant"> </span><span class="Conceal">¦</span><span class="Constant"> </span><span class="Conceal">¦</span><span class="Constant"> |xyz|</span> <span id="L8" class="LineNr"> 8 </span> <span class="Conceal">¦</span> ] <span id="L9" class="LineNr"> 9 </span> ] -<span id="L10" class="LineNr">10 </span> contents:&:source:char <span class="Special"><-</span> <a href='088file.mu.html#L21'>start-reading</a> <a href='088file.mu.html#L11'>resources</a>, <span class="Constant">[a]</span> +<span id="L10" class="LineNr">10 </span> contents:&:<a href='075channel.mu.html#L43'>source</a>:char <span class="Special"><-</span> <a href='088file.mu.html#L21'>start-reading</a> <a href='088file.mu.html#L11'>resources</a>, <span class="Constant">[a]</span> <span id="L11" class="LineNr">11 </span> 1:char/<span class="Special">raw</span> <span class="Special"><-</span> read contents <span id="L12" class="LineNr">12 </span> 2:char/<span class="Special">raw</span> <span class="Special"><-</span> read contents <span id="L13" class="LineNr">13 </span> 3:char/<span class="Special">raw</span> <span class="Special"><-</span> read contents @@ -84,10 +84,10 @@ if ('onhashchange' in window) { <span id="L26" class="LineNr">26 </span> <span class="Constant">local-scope</span> <span id="L27" class="LineNr">27 </span> assume-resources [ <span id="L28" class="LineNr">28 </span> ] -<span id="L29" class="LineNr">29 </span> sink:&:sink:char, writer:num/routine <span class="Special"><-</span> <a href='088file.mu.html#L105'>start-writing</a> <a href='088file.mu.html#L11'>resources</a>, <span class="Constant">[a]</span> -<span id="L30" class="LineNr">30 </span> sink <span class="Special"><-</span> <a href='075channel.mu.html#L66'>write</a> sink, <span class="Constant">120/x</span> -<span id="L31" class="LineNr">31 </span> sink <span class="Special"><-</span> <a href='075channel.mu.html#L66'>write</a> sink, <span class="Constant">121/y</span> -<span id="L32" class="LineNr">32 </span> close sink +<span id="L29" class="LineNr">29 </span> <a href='075channel.mu.html#L47'>sink</a>:&:<a href='075channel.mu.html#L47'>sink</a>:char, writer:num/routine <span class="Special"><-</span> <a href='088file.mu.html#L105'>start-writing</a> <a href='088file.mu.html#L11'>resources</a>, <span class="Constant">[a]</span> +<span id="L30" class="LineNr">30 </span> <a href='075channel.mu.html#L47'>sink</a> <span class="Special"><-</span> <a href='075channel.mu.html#L66'>write</a> <a href='075channel.mu.html#L47'>sink</a>, <span class="Constant">120/x</span> +<span id="L31" class="LineNr">31 </span> <a href='075channel.mu.html#L47'>sink</a> <span class="Special"><-</span> <a href='075channel.mu.html#L66'>write</a> <a href='075channel.mu.html#L47'>sink</a>, <span class="Constant">121/y</span> +<span id="L32" class="LineNr">32 </span> close <a href='075channel.mu.html#L47'>sink</a> <span id="L33" class="LineNr">33 </span> wait-for-routine writer <span id="L34" class="LineNr">34 </span> contents-read-back:text <span class="Special"><-</span> <a href='088file.mu.html#L38'>slurp</a> <a href='088file.mu.html#L11'>resources</a>, <span class="Constant">[a]</span> <span id="L35" class="LineNr">35 </span> 10:bool/<span class="Special">raw</span> <span class="Special"><-</span> equal contents-read-back, <span class="Constant">[xy]</span> @@ -103,10 +103,10 @@ if ('onhashchange' in window) { <span id="L45" class="LineNr">45 </span><span class="Constant"> </span><span class="Conceal">¦</span><span class="Constant"> </span><span class="Conceal">¦</span><span class="Constant"> |abc|</span> <span id="L46" class="LineNr">46 </span> <span class="Conceal">¦</span> ] <span id="L47" class="LineNr">47 </span> ] -<span id="L48" class="LineNr">48 </span> sink:&:sink:char, writer:num/routine <span class="Special"><-</span> <a href='088file.mu.html#L105'>start-writing</a> <a href='088file.mu.html#L11'>resources</a>, <span class="Constant">[b]</span> -<span id="L49" class="LineNr">49 </span> sink <span class="Special"><-</span> <a href='075channel.mu.html#L66'>write</a> sink, <span class="Constant">120/x</span> -<span id="L50" class="LineNr">50 </span> sink <span class="Special"><-</span> <a href='075channel.mu.html#L66'>write</a> sink, <span class="Constant">121/y</span> -<span id="L51" class="LineNr">51 </span> close sink +<span id="L48" class="LineNr">48 </span> <a href='075channel.mu.html#L47'>sink</a>:&:<a href='075channel.mu.html#L47'>sink</a>:char, writer:num/routine <span class="Special"><-</span> <a href='088file.mu.html#L105'>start-writing</a> <a href='088file.mu.html#L11'>resources</a>, <span class="Constant">[b]</span> +<span id="L49" class="LineNr">49 </span> <a href='075channel.mu.html#L47'>sink</a> <span class="Special"><-</span> <a href='075channel.mu.html#L66'>write</a> <a href='075channel.mu.html#L47'>sink</a>, <span class="Constant">120/x</span> +<span id="L50" class="LineNr">50 </span> <a href='075channel.mu.html#L47'>sink</a> <span class="Special"><-</span> <a href='075channel.mu.html#L66'>write</a> <a href='075channel.mu.html#L47'>sink</a>, <span class="Constant">121/y</span> +<span id="L51" class="LineNr">51 </span> close <a href='075channel.mu.html#L47'>sink</a> <span id="L52" class="LineNr">52 </span> wait-for-routine writer <span id="L53" class="LineNr">53 </span> contents-read-back:text <span class="Special"><-</span> <a href='088file.mu.html#L38'>slurp</a> <a href='088file.mu.html#L11'>resources</a>, <span class="Constant">[b]</span> <span id="L54" class="LineNr">54 </span> 10:bool/<span class="Special">raw</span> <span class="Special"><-</span> equal contents-read-back, <span class="Constant">[xy]</span> @@ -120,10 +120,10 @@ if ('onhashchange' in window) { <span id="L62" class="LineNr">62 </span> assume-resources [ <span id="L63" class="LineNr">63 </span> <span class="Conceal">¦</span> <span class="Constant">[a]</span> <span class="Special"><-</span> <span class="Constant">[]</span> <span id="L64" class="LineNr">64 </span> ] -<span id="L65" class="LineNr">65 </span> sink:&:sink:char, writer:num/routine <span class="Special"><-</span> <a href='088file.mu.html#L105'>start-writing</a> <a href='088file.mu.html#L11'>resources</a>, <span class="Constant">[a]</span> -<span id="L66" class="LineNr">66 </span> sink <span class="Special"><-</span> <a href='075channel.mu.html#L66'>write</a> sink, <span class="Constant">120/x</span> -<span id="L67" class="LineNr">67 </span> sink <span class="Special"><-</span> <a href='075channel.mu.html#L66'>write</a> sink, <span class="Constant">121/y</span> -<span id="L68" class="LineNr">68 </span> close sink +<span id="L65" class="LineNr">65 </span> <a href='075channel.mu.html#L47'>sink</a>:&:<a href='075channel.mu.html#L47'>sink</a>:char, writer:num/routine <span class="Special"><-</span> <a href='088file.mu.html#L105'>start-writing</a> <a href='088file.mu.html#L11'>resources</a>, <span class="Constant">[a]</span> +<span id="L66" class="LineNr">66 </span> <a href='075channel.mu.html#L47'>sink</a> <span class="Special"><-</span> <a href='075channel.mu.html#L66'>write</a> <a href='075channel.mu.html#L47'>sink</a>, <span class="Constant">120/x</span> +<span id="L67" class="LineNr">67 </span> <a href='075channel.mu.html#L47'>sink</a> <span class="Special"><-</span> <a href='075channel.mu.html#L66'>write</a> <a href='075channel.mu.html#L47'>sink</a>, <span class="Constant">121/y</span> +<span id="L68" class="LineNr">68 </span> close <a href='075channel.mu.html#L47'>sink</a> <span id="L69" class="LineNr">69 </span> wait-for-routine writer <span id="L70" class="LineNr">70 </span> contents-read-back:text <span class="Special"><-</span> <a href='088file.mu.html#L38'>slurp</a> <a href='088file.mu.html#L11'>resources</a>, <span class="Constant">[a]</span> <span id="L71" class="LineNr">71 </span> 10:bool/<span class="Special">raw</span> <span class="Special"><-</span> equal contents-read-back, <span class="Constant">[xy]</span> @@ -140,10 +140,10 @@ if ('onhashchange' in window) { <span id="L82" class="LineNr">82 </span><span class="Constant"> </span><span class="Conceal">¦</span><span class="Constant"> </span><span class="Conceal">¦</span><span class="Constant"> |bcd|</span> <span id="L83" class="LineNr">83 </span> <span class="Conceal">¦</span> ] <span id="L84" class="LineNr">84 </span> ] -<span id="L85" class="LineNr">85 </span> sink:&:sink:char, writer:num/routine <span class="Special"><-</span> <a href='088file.mu.html#L105'>start-writing</a> <a href='088file.mu.html#L11'>resources</a>, <span class="Constant">[a]</span> -<span id="L86" class="LineNr">86 </span> sink <span class="Special"><-</span> <a href='075channel.mu.html#L66'>write</a> sink, <span class="Constant">120/x</span> -<span id="L87" class="LineNr">87 </span> sink <span class="Special"><-</span> <a href='075channel.mu.html#L66'>write</a> sink, <span class="Constant">121/y</span> -<span id="L88" class="LineNr">88 </span> close sink +<span id="L85" class="LineNr">85 </span> <a href='075channel.mu.html#L47'>sink</a>:&:<a href='075channel.mu.html#L47'>sink</a>:char, writer:num/routine <span class="Special"><-</span> <a href='088file.mu.html#L105'>start-writing</a> <a href='088file.mu.html#L11'>resources</a>, <span class="Constant">[a]</span> +<span id="L86" class="LineNr">86 </span> <a href='075channel.mu.html#L47'>sink</a> <span class="Special"><-</span> <a href='075channel.mu.html#L66'>write</a> <a href='075channel.mu.html#L47'>sink</a>, <span class="Constant">120/x</span> +<span id="L87" class="LineNr">87 </span> <a href='075channel.mu.html#L47'>sink</a> <span class="Special"><-</span> <a href='075channel.mu.html#L66'>write</a> <a href='075channel.mu.html#L47'>sink</a>, <span class="Constant">121/y</span> +<span id="L88" class="LineNr">88 </span> close <a href='075channel.mu.html#L47'>sink</a> <span id="L89" class="LineNr">89 </span> wait-for-routine writer <span id="L90" class="LineNr">90 </span> contents-read-back:text <span class="Special"><-</span> <a href='088file.mu.html#L38'>slurp</a> <a href='088file.mu.html#L11'>resources</a>, <span class="Constant">[a]</span> <span id="L91" class="LineNr">91 </span> 10:bool/<span class="Special">raw</span> <span class="Special"><-</span> equal contents-read-back, <span class="Constant">[xy]</span> diff --git a/html/092socket.mu.html b/html/092socket.mu.html index fc6e3b0f..7fd3f9c6 100644 --- a/html/092socket.mu.html +++ b/html/092socket.mu.html @@ -76,8 +76,8 @@ if ('onhashchange' in window) { <span id="L14" class="LineNr"> 14 </span><span class="Constant">F - example-server-test: $open-server-socket failed]</span> <span id="L15" class="LineNr"> 15 </span> <span class="Conceal">¦</span> handler-routine:number <span class="Special"><-</span> start-running <a href='092socket.mu.html#L55'>serve-one-request</a> socket, <a href='092socket.mu.html#L26'>example-handler</a> <span id="L16" class="LineNr"> 16 </span> ] -<span id="L17" class="LineNr"> 17 </span> source:&:source:char <span class="Special"><-</span> <a href='092socket.mu.html#L69'>start-reading-from-network</a> <span class="Constant">0/real-resources</span>, <span class="Constant">[localhost/]</span>, port -<span id="L18" class="LineNr"> 18 </span> response:text <span class="Special"><-</span> <a href='075channel.mu.html#L487'>drain</a> source +<span id="L17" class="LineNr"> 17 </span> <a href='075channel.mu.html#L43'>source</a>:&:<a href='075channel.mu.html#L43'>source</a>:char <span class="Special"><-</span> <a href='092socket.mu.html#L69'>start-reading-from-network</a> <span class="Constant">0/real-resources</span>, <span class="Constant">[localhost/]</span>, port +<span id="L18" class="LineNr"> 18 </span> response:text <span class="Special"><-</span> <a href='075channel.mu.html#L487'>drain</a> <a href='075channel.mu.html#L43'>source</a> <span id="L19" class="LineNr"> 19 </span> 10:@:char/<span class="Special">raw</span> <span class="Special"><-</span> copy *response <span id="L20" class="LineNr"> 20 </span> memory-should-contain [ <span id="L21" class="LineNr"> 21 </span> <span class="Conceal">¦</span> 10:array:character <span class="Special"><-</span> <span class="Constant">[abc]</span> @@ -102,9 +102,9 @@ if ('onhashchange' in window) { <span id="L40" class="LineNr"> 40 </span> <span class="Conceal">¦</span> ] <span id="L41" class="LineNr"> 41 </span> ] <span id="L42" class="LineNr"> 42 </span> run [ -<span id="L43" class="LineNr"> 43 </span> <span class="Conceal">¦</span> source:&:source:char <span class="Special"><-</span> <a href='092socket.mu.html#L69'>start-reading-from-network</a> <a href='088file.mu.html#L11'>resources</a>, <span class="Constant">[example.com/]</span> +<span id="L43" class="LineNr"> 43 </span> <span class="Conceal">¦</span> <a href='075channel.mu.html#L43'>source</a>:&:<a href='075channel.mu.html#L43'>source</a>:char <span class="Special"><-</span> <a href='092socket.mu.html#L69'>start-reading-from-network</a> <a href='088file.mu.html#L11'>resources</a>, <span class="Constant">[example.com/]</span> <span id="L44" class="LineNr"> 44 </span> ] -<span id="L45" class="LineNr"> 45 </span> contents:text <span class="Special"><-</span> <a href='075channel.mu.html#L487'>drain</a> source +<span id="L45" class="LineNr"> 45 </span> contents:text <span class="Special"><-</span> <a href='075channel.mu.html#L487'>drain</a> <a href='075channel.mu.html#L43'>source</a> <span id="L46" class="LineNr"> 46 </span> 10:@:char/<span class="Special">raw</span> <span class="Special"><-</span> copy *contents <span id="L47" class="LineNr"> 47 </span> memory-should-contain [ <span id="L48" class="LineNr"> 48 </span> <span class="Conceal">¦</span> 10:array:character <span class="Special"><-</span> <span class="Constant">[abc</span> @@ -120,15 +120,15 @@ if ('onhashchange' in window) { <span id="L58" class="LineNr"> 58 </span> session:num <span class="Special"><-</span> $accept socket <span id="L59" class="LineNr"> 59 </span> assert session, <span class="Constant">[ </span> <span id="L60" class="LineNr"> 60 </span><span class="Constant">F - example-server-test: $accept failed]</span> -<span id="L61" class="LineNr"> 61 </span> contents:&:source:char, sink:&:sink:char <span class="Special"><-</span> <a href='075channel.mu.html#L51'>new-channel</a><span class="Constant"> 30</span> -<span id="L62" class="LineNr"> 62 </span> start-running <a href='092socket.mu.html#L104'>receive-from-socket</a> session, sink +<span id="L61" class="LineNr"> 61 </span> contents:&:<a href='075channel.mu.html#L43'>source</a>:char, <a href='075channel.mu.html#L47'>sink</a>:&:<a href='075channel.mu.html#L47'>sink</a>:char <span class="Special"><-</span> <a href='075channel.mu.html#L51'>new-channel</a><span class="Constant"> 30</span> +<span id="L62" class="LineNr"> 62 </span> start-running <a href='092socket.mu.html#L104'>receive-from-socket</a> session, <a href='075channel.mu.html#L47'>sink</a> <span id="L63" class="LineNr"> 63 </span> query:text <span class="Special"><-</span> <a href='075channel.mu.html#L487'>drain</a> contents <span id="L64" class="LineNr"> 64 </span> response:text <span class="Special"><-</span> call request-handler, query <span id="L65" class="LineNr"> 65 </span> <a href='092socket.mu.html#L132'>write-to-socket</a> session, response <span id="L66" class="LineNr"> 66 </span> session <span class="Special"><-</span> $close-socket session <span id="L67" class="LineNr"> 67 </span>] <span id="L68" class="LineNr"> 68 </span> -<span id="L69" class="LineNr"> 69 </span><span class="muRecipe">def</span> <a href='092socket.mu.html#L69'>start-reading-from-network</a> <a href='088file.mu.html#L11'>resources</a>:&:<a href='088file.mu.html#L11'>resources</a>, uri:text<span class="muRecipe"> -> </span>contents:&:source:char [ +<span id="L69" class="LineNr"> 69 </span><span class="muRecipe">def</span> <a href='092socket.mu.html#L69'>start-reading-from-network</a> <a href='088file.mu.html#L11'>resources</a>:&:<a href='088file.mu.html#L11'>resources</a>, uri:text<span class="muRecipe"> -> </span>contents:&:<a href='075channel.mu.html#L43'>source</a>:char [ <span id="L70" class="LineNr"> 70 </span> <span class="Constant">local-scope</span> <span id="L71" class="LineNr"> 71 </span> <span class="Constant">load-ingredients</span> <span id="L72" class="LineNr"> 72 </span> <span class="Delimiter">{</span> @@ -148,8 +148,8 @@ if ('onhashchange' in window) { <span id="L86" class="LineNr"> 86 </span> assert socket, <span class="Constant">[contents]</span> <span id="L87" class="LineNr"> 87 </span> req:text <span class="Special"><-</span> <a href='061text.mu.html#L505'>interpolate</a> <span class="Constant">[GET _ HTTP/1.1]</span>, path <span id="L88" class="LineNr"> 88 </span> <a href='092socket.mu.html#L93'>request-socket</a> socket, req -<span id="L89" class="LineNr"> 89 </span> contents:&:source:char, sink:&:sink:char <span class="Special"><-</span> <a href='075channel.mu.html#L51'>new-channel</a><span class="Constant"> 10000</span> -<span id="L90" class="LineNr"> 90 </span> start-running <a href='092socket.mu.html#L125'>receive-from-client-socket-and-close</a> socket, sink +<span id="L89" class="LineNr"> 89 </span> contents:&:<a href='075channel.mu.html#L43'>source</a>:char, <a href='075channel.mu.html#L47'>sink</a>:&:<a href='075channel.mu.html#L47'>sink</a>:char <span class="Special"><-</span> <a href='075channel.mu.html#L51'>new-channel</a><span class="Constant"> 10000</span> +<span id="L90" class="LineNr"> 90 </span> start-running <a href='092socket.mu.html#L125'>receive-from-client-socket-and-close</a> socket, <a href='075channel.mu.html#L47'>sink</a> <span id="L91" class="LineNr"> 91 </span>] <span id="L92" class="LineNr"> 92 </span> <span id="L93" class="LineNr"> 93 </span><span class="muRecipe">def</span> <a href='092socket.mu.html#L93'>request-socket</a> socket:num, s:text<span class="muRecipe"> -> </span>socket:num [ @@ -163,7 +163,7 @@ if ('onhashchange' in window) { <span id="L101" class="LineNr">101 </span> $write-to-socket socket, <span class="Constant">10/lf</span> <span id="L102" class="LineNr">102 </span>] <span id="L103" class="LineNr">103 </span> -<span id="L104" class="LineNr">104 </span><span class="muRecipe">def</span> <a href='092socket.mu.html#L104'>receive-from-socket</a> socket:num, sink:&:sink:char<span class="muRecipe"> -> </span>sink:&:sink:char, socket:num [ +<span id="L104" class="LineNr">104 </span><span class="muRecipe">def</span> <a href='092socket.mu.html#L104'>receive-from-socket</a> socket:num, <a href='075channel.mu.html#L47'>sink</a>:&:<a href='075channel.mu.html#L47'>sink</a>:char<span class="muRecipe"> -> </span><a href='075channel.mu.html#L47'>sink</a>:&:<a href='075channel.mu.html#L47'>sink</a>:char, socket:num [ <span id="L105" class="LineNr">105 </span> <span class="Constant">local-scope</span> <span id="L106" class="LineNr">106 </span> <span class="Constant">load-ingredients</span> <span id="L107" class="LineNr">107 </span> <span class="Delimiter">{</span> @@ -173,7 +173,7 @@ if ('onhashchange' in window) { <span id="L111" class="LineNr">111 </span> <span class="Conceal">¦</span> <span class="muControl">break-if</span> error <span id="L112" class="LineNr">112 </span> <span class="Conceal">¦</span> <span class="Delimiter">{</span> <span id="L113" class="LineNr">113 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="muControl">break-unless</span> found? -<span id="L114" class="LineNr">114 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> sink <span class="Special"><-</span> <a href='075channel.mu.html#L66'>write</a> sink, c +<span id="L114" class="LineNr">114 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <a href='075channel.mu.html#L47'>sink</a> <span class="Special"><-</span> <a href='075channel.mu.html#L66'>write</a> <a href='075channel.mu.html#L47'>sink</a>, c <span id="L115" class="LineNr">115 </span> <span class="Conceal">¦</span> <span class="Delimiter">}</span> <span id="L116" class="LineNr">116 </span> <span class="Conceal">¦</span> <span class="Delimiter">{</span> <span id="L117" class="LineNr">117 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="muControl">break-if</span> found? @@ -181,13 +181,13 @@ if ('onhashchange' in window) { <span id="L119" class="LineNr">119 </span> <span class="Conceal">¦</span> <span class="Delimiter">}</span> <span id="L120" class="LineNr">120 </span> <span class="Conceal">¦</span> <span class="muControl">loop</span> <span id="L121" class="LineNr">121 </span> <span class="Delimiter">}</span> -<span id="L122" class="LineNr">122 </span> sink <span class="Special"><-</span> close sink +<span id="L122" class="LineNr">122 </span> <a href='075channel.mu.html#L47'>sink</a> <span class="Special"><-</span> close <a href='075channel.mu.html#L47'>sink</a> <span id="L123" class="LineNr">123 </span>] <span id="L124" class="LineNr">124 </span> -<span id="L125" class="LineNr">125 </span><span class="muRecipe">def</span> <a href='092socket.mu.html#L125'>receive-from-client-socket-and-close</a> socket:num, sink:&:sink:char<span class="muRecipe"> -> </span>sink:&:sink:char, socket:num [ +<span id="L125" class="LineNr">125 </span><span class="muRecipe">def</span> <a href='092socket.mu.html#L125'>receive-from-client-socket-and-close</a> socket:num, <a href='075channel.mu.html#L47'>sink</a>:&:<a href='075channel.mu.html#L47'>sink</a>:char<span class="muRecipe"> -> </span><a href='075channel.mu.html#L47'>sink</a>:&:<a href='075channel.mu.html#L47'>sink</a>:char, socket:num [ <span id="L126" class="LineNr">126 </span> <span class="Constant">local-scope</span> <span id="L127" class="LineNr">127 </span> <span class="Constant">load-ingredients</span> -<span id="L128" class="LineNr">128 </span> sink <span class="Special"><-</span> <a href='092socket.mu.html#L104'>receive-from-socket</a> socket, sink +<span id="L128" class="LineNr">128 </span> <a href='075channel.mu.html#L47'>sink</a> <span class="Special"><-</span> <a href='092socket.mu.html#L104'>receive-from-socket</a> socket, <a href='075channel.mu.html#L47'>sink</a> <span id="L129" class="LineNr">129 </span> socket <span class="Special"><-</span> $close-socket socket <span id="L130" class="LineNr">130 </span>] <span id="L131" class="LineNr">131 </span> diff --git a/html/channel.mu.html b/html/channel.mu.html index bc5b1141..bb0808f1 100644 --- a/html/channel.mu.html +++ b/html/channel.mu.html @@ -60,7 +60,7 @@ if ('onhashchange' in window) { <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment"># example program: communicating between routines using channels</span> <span id="L2" class="LineNr"> 2 </span> -<span id="L3" class="LineNr"> 3 </span><span class="muRecipe">def</span> <a href='channel.mu.html#L3'>producer</a> sink:&:sink:char<span class="muRecipe"> -> </span>sink:&:sink:char [ +<span id="L3" class="LineNr"> 3 </span><span class="muRecipe">def</span> <a href='channel.mu.html#L3'>producer</a> <a href='075channel.mu.html#L47'>sink</a>:&:<a href='075channel.mu.html#L47'>sink</a>:char<span class="muRecipe"> -> </span><a href='075channel.mu.html#L47'>sink</a>:&:<a href='075channel.mu.html#L47'>sink</a>:char [ <span id="L4" class="LineNr"> 4 </span> <span class="Comment"># produce characters 1 to 5 on a channel</span> <span id="L5" class="LineNr"> 5 </span> <span class="Constant">local-scope</span> <span id="L6" class="LineNr"> 6 </span> <span class="Constant">load-ingredients</span> @@ -72,20 +72,20 @@ if ('onhashchange' in window) { <span id="L12" class="LineNr">12 </span> <span class="Conceal">¦</span> <span class="Comment"># other threads might get between these prints</span> <span id="L13" class="LineNr">13 </span> <span class="Conceal">¦</span> $print <span class="Constant">[produce: ]</span>, n, <span class="Constant">[ </span> <span id="L14" class="LineNr">14 </span><span class="Constant">]</span> -<span id="L15" class="LineNr">15 </span> <span class="Conceal">¦</span> sink <span class="Special"><-</span> <a href='075channel.mu.html#L66'>write</a> sink, n +<span id="L15" class="LineNr">15 </span> <span class="Conceal">¦</span> <a href='075channel.mu.html#L47'>sink</a> <span class="Special"><-</span> <a href='075channel.mu.html#L66'>write</a> <a href='075channel.mu.html#L47'>sink</a>, n <span id="L16" class="LineNr">16 </span> <span class="Conceal">¦</span> n <span class="Special"><-</span> add n,<span class="Constant"> 1</span> <span id="L17" class="LineNr">17 </span> <span class="Conceal">¦</span> <span class="muControl">loop</span> <span id="L18" class="LineNr">18 </span> <span class="Delimiter">}</span> -<span id="L19" class="LineNr">19 </span> close sink +<span id="L19" class="LineNr">19 </span> close <a href='075channel.mu.html#L47'>sink</a> <span id="L20" class="LineNr">20 </span>] <span id="L21" class="LineNr">21 </span> -<span id="L22" class="LineNr">22 </span><span class="muRecipe">def</span> <a href='channel.mu.html#L22'>consumer</a> source:&:source:char<span class="muRecipe"> -> </span>source:&:source:char [ +<span id="L22" class="LineNr">22 </span><span class="muRecipe">def</span> <a href='channel.mu.html#L22'>consumer</a> <a href='075channel.mu.html#L43'>source</a>:&:<a href='075channel.mu.html#L43'>source</a>:char<span class="muRecipe"> -> </span><a href='075channel.mu.html#L43'>source</a>:&:<a href='075channel.mu.html#L43'>source</a>:char [ <span id="L23" class="LineNr">23 </span> <span class="Comment"># consume and print integers from a channel</span> <span id="L24" class="LineNr">24 </span> <span class="Constant">local-scope</span> <span id="L25" class="LineNr">25 </span> <span class="Constant">load-ingredients</span> <span id="L26" class="LineNr">26 </span> <span class="Delimiter">{</span> <span id="L27" class="LineNr">27 </span> <span class="Conceal">¦</span> <span class="Comment"># read an integer from the channel</span> -<span id="L28" class="LineNr">28 </span> <span class="Conceal">¦</span> n:char, eof?:bool, source <span class="Special"><-</span> read source +<span id="L28" class="LineNr">28 </span> <span class="Conceal">¦</span> n:char, eof?:bool, <a href='075channel.mu.html#L43'>source</a> <span class="Special"><-</span> read <a href='075channel.mu.html#L43'>source</a> <span id="L29" class="LineNr">29 </span> <span class="Conceal">¦</span> <span class="muControl">break-if</span> eof? <span id="L30" class="LineNr">30 </span> <span class="Conceal">¦</span> <span class="Comment"># other threads might get between these prints</span> <span id="L31" class="LineNr">31 </span> <span class="Conceal">¦</span> $print <span class="Constant">[consume: ]</span>, n:char, <span class="Constant">[ </span> @@ -96,10 +96,10 @@ if ('onhashchange' in window) { <span id="L36" class="LineNr">36 </span> <span id="L37" class="LineNr">37 </span><span class="muRecipe">def</span> <a href='channel.mu.html#L37'>main</a> [ <span id="L38" class="LineNr">38 </span> <span class="Constant">local-scope</span> -<span id="L39" class="LineNr">39 </span> source:&:source:char, sink:&:sink:char <span class="Special"><-</span> <a href='075channel.mu.html#L51'>new-channel</a> <span class="Constant">3/capacity</span> +<span id="L39" class="LineNr">39 </span> <a href='075channel.mu.html#L43'>source</a>:&:<a href='075channel.mu.html#L43'>source</a>:char, <a href='075channel.mu.html#L47'>sink</a>:&:<a href='075channel.mu.html#L47'>sink</a>:char <span class="Special"><-</span> <a href='075channel.mu.html#L51'>new-channel</a> <span class="Constant">3/capacity</span> <span id="L40" class="LineNr">40 </span> <span class="Comment"># create two background 'routines' that communicate by a channel</span> -<span id="L41" class="LineNr">41 </span> routine1:num <span class="Special"><-</span> start-running <a href='channel.mu.html#L3'>producer</a>, sink -<span id="L42" class="LineNr">42 </span> routine2:num <span class="Special"><-</span> start-running <a href='channel.mu.html#L22'>consumer</a>, source +<span id="L41" class="LineNr">41 </span> routine1:num <span class="Special"><-</span> start-running <a href='channel.mu.html#L3'>producer</a>, <a href='075channel.mu.html#L47'>sink</a> +<span id="L42" class="LineNr">42 </span> routine2:num <span class="Special"><-</span> start-running <a href='channel.mu.html#L22'>consumer</a>, <a href='075channel.mu.html#L43'>source</a> <span id="L43" class="LineNr">43 </span> wait-for-routine routine1 <span id="L44" class="LineNr">44 </span> wait-for-routine routine2 <span id="L45" class="LineNr">45 </span>] diff --git a/html/chessboard.mu.html b/html/chessboard.mu.html index a598c8f7..7129dfea 100644 --- a/html/chessboard.mu.html +++ b/html/chessboard.mu.html @@ -134,10 +134,10 @@ if ('onhashchange' in window) { <span id="L70" class="LineNr"> 70 </span> <span class="Constant">load-ingredients</span> <span id="L71" class="LineNr"> 71 </span> board:board <span class="Special"><-</span> <a href='chessboard.mu.html#L179'>initial-position</a> <span id="L72" class="LineNr"> 72 </span> <span class="Comment"># hook up stdin</span> -<span id="L73" class="LineNr"> 73 </span> stdin-in:&:source:char, stdin-out:&:sink:char <span class="Special"><-</span> <a href='075channel.mu.html#L51'>new-channel</a> <span class="Constant">10/capacity</span> +<span id="L73" class="LineNr"> 73 </span> stdin-in:&:<a href='075channel.mu.html#L43'>source</a>:char, stdin-out:&:<a href='075channel.mu.html#L47'>sink</a>:char <span class="Special"><-</span> <a href='075channel.mu.html#L51'>new-channel</a> <span class="Constant">10/capacity</span> <span id="L74" class="LineNr"> 74 </span> start-running <a href='084console.mu.html#L73'>send-keys-to-channel</a>, <a href='084console.mu.html#L23'>console</a>, stdin-out, <a href='081print.mu.html#L4'>screen</a> <span id="L75" class="LineNr"> 75 </span> <span class="Comment"># buffer lines in stdin</span> -<span id="L76" class="LineNr"> 76 </span> buffered-stdin-in:&:source:char, buffered-stdin-out:&:sink:char <span class="Special"><-</span> <a href='075channel.mu.html#L51'>new-channel</a> <span class="Constant">10/capacity</span> +<span id="L76" class="LineNr"> 76 </span> buffered-stdin-in:&:<a href='075channel.mu.html#L43'>source</a>:char, buffered-stdin-out:&:<a href='075channel.mu.html#L47'>sink</a>:char <span class="Special"><-</span> <a href='075channel.mu.html#L51'>new-channel</a> <span class="Constant">10/capacity</span> <span id="L77" class="LineNr"> 77 </span> start-running <a href='075channel.mu.html#L388'>buffer-lines</a>, stdin-in, buffered-stdin-out <span id="L78" class="LineNr"> 78 </span> <span class="Delimiter">{</span> <span id="L79" class="LineNr"> 79 </span> <span class="Conceal">¦</span> print <a href='081print.mu.html#L4'>screen</a>, <span class="Constant">[Stupid text-mode chessboard. White pieces in uppercase; black pieces in lowercase. No checking for legal moves.</span> @@ -298,7 +298,7 @@ if ('onhashchange' in window) { <span id="L234" class="LineNr">234 </span>] <span id="L235" class="LineNr">235 </span> <span id="L236" class="LineNr">236 </span><span class="Comment"># prints only error messages to screen</span> -<span id="L237" class="LineNr">237 </span><span class="muRecipe">def</span> <a href='chessboard.mu.html#L237'>read-move</a> stdin:&:source:char, <a href='081print.mu.html#L4'>screen</a>:&:<a href='081print.mu.html#L4'>screen</a><span class="muRecipe"> -> </span>result:&:<a href='chessboard.mu.html#L228'>move</a>, quit?:bool, error?:bool, stdin:&:source:char, <a href='081print.mu.html#L4'>screen</a>:&:<a href='081print.mu.html#L4'>screen</a> [ +<span id="L237" class="LineNr">237 </span><span class="muRecipe">def</span> <a href='chessboard.mu.html#L237'>read-move</a> stdin:&:<a href='075channel.mu.html#L43'>source</a>:char, <a href='081print.mu.html#L4'>screen</a>:&:<a href='081print.mu.html#L4'>screen</a><span class="muRecipe"> -> </span>result:&:<a href='chessboard.mu.html#L228'>move</a>, quit?:bool, error?:bool, stdin:&:<a href='075channel.mu.html#L43'>source</a>:char, <a href='081print.mu.html#L4'>screen</a>:&:<a href='081print.mu.html#L4'>screen</a> [ <span id="L238" class="LineNr">238 </span> <span class="Constant">local-scope</span> <span id="L239" class="LineNr">239 </span> <span class="Constant">load-ingredients</span> <span id="L240" class="LineNr">240 </span> from-file:num, quit?:bool, error?:bool <span class="Special"><-</span> <a href='chessboard.mu.html#L265'>read-file</a> stdin, <a href='081print.mu.html#L4'>screen</a> @@ -326,7 +326,7 @@ if ('onhashchange' in window) { <span id="L262" class="LineNr">262 </span>] <span id="L263" class="LineNr">263 </span> <span id="L264" class="LineNr">264 </span><span class="Comment"># valid values for file: 0-7</span> -<span id="L265" class="LineNr">265 </span><span class="muRecipe">def</span> <a href='chessboard.mu.html#L265'>read-file</a> stdin:&:source:char, <a href='081print.mu.html#L4'>screen</a>:&:<a href='081print.mu.html#L4'>screen</a><span class="muRecipe"> -> </span>file:num, quit:bool, error:bool, stdin:&:source:char, <a href='081print.mu.html#L4'>screen</a>:&:<a href='081print.mu.html#L4'>screen</a> [ +<span id="L265" class="LineNr">265 </span><span class="muRecipe">def</span> <a href='chessboard.mu.html#L265'>read-file</a> stdin:&:<a href='075channel.mu.html#L43'>source</a>:char, <a href='081print.mu.html#L4'>screen</a>:&:<a href='081print.mu.html#L4'>screen</a><span class="muRecipe"> -> </span>file:num, quit:bool, error:bool, stdin:&:<a href='075channel.mu.html#L43'>source</a>:char, <a href='081print.mu.html#L4'>screen</a>:&:<a href='081print.mu.html#L4'>screen</a> [ <span id="L266" class="LineNr">266 </span> <span class="Constant">local-scope</span> <span id="L267" class="LineNr">267 </span> <span class="Constant">load-ingredients</span> <span id="L268" class="LineNr">268 </span> c:char, eof?:bool, stdin <span class="Special"><-</span> read stdin @@ -373,7 +373,7 @@ if ('onhashchange' in window) { <span id="L309" class="LineNr">309 </span>] <span id="L310" class="LineNr">310 </span> <span id="L311" class="LineNr">311 </span><span class="Comment"># valid values for rank: 0-7</span> -<span id="L312" class="LineNr">312 </span><span class="muRecipe">def</span> <a href='chessboard.mu.html#L312'>read-rank</a> stdin:&:source:char, <a href='081print.mu.html#L4'>screen</a>:&:<a href='081print.mu.html#L4'>screen</a><span class="muRecipe"> -> </span>rank:num, quit?:bool, error?:bool, stdin:&:source:char, <a href='081print.mu.html#L4'>screen</a>:&:<a href='081print.mu.html#L4'>screen</a> [ +<span id="L312" class="LineNr">312 </span><span class="muRecipe">def</span> <a href='chessboard.mu.html#L312'>read-rank</a> stdin:&:<a href='075channel.mu.html#L43'>source</a>:char, <a href='081print.mu.html#L4'>screen</a>:&:<a href='081print.mu.html#L4'>screen</a><span class="muRecipe"> -> </span>rank:num, quit?:bool, error?:bool, stdin:&:<a href='075channel.mu.html#L43'>source</a>:char, <a href='081print.mu.html#L4'>screen</a>:&:<a href='081print.mu.html#L4'>screen</a> [ <span id="L313" class="LineNr">313 </span> <span class="Constant">local-scope</span> <span id="L314" class="LineNr">314 </span> <span class="Constant">load-ingredients</span> <span id="L315" class="LineNr">315 </span> c:char, eof?:bool, stdin <span class="Special"><-</span> read stdin @@ -415,7 +415,7 @@ if ('onhashchange' in window) { <span id="L351" class="LineNr">351 </span> <span id="L352" class="LineNr">352 </span><span class="Comment"># read a character from the given channel and check that it's what we expect</span> <span id="L353" class="LineNr">353 </span><span class="Comment"># return true on error</span> -<span id="L354" class="LineNr">354 </span><span class="muRecipe">def</span> <a href='chessboard.mu.html#L354'>expect-from-channel</a> stdin:&:source:char, expected:char, <a href='081print.mu.html#L4'>screen</a>:&:<a href='081print.mu.html#L4'>screen</a><span class="muRecipe"> -> </span>result:bool, stdin:&:source:char, <a href='081print.mu.html#L4'>screen</a>:&:<a href='081print.mu.html#L4'>screen</a> [ +<span id="L354" class="LineNr">354 </span><span class="muRecipe">def</span> <a href='chessboard.mu.html#L354'>expect-from-channel</a> stdin:&:<a href='075channel.mu.html#L43'>source</a>:char, expected:char, <a href='081print.mu.html#L4'>screen</a>:&:<a href='081print.mu.html#L4'>screen</a><span class="muRecipe"> -> </span>result:bool, stdin:&:<a href='075channel.mu.html#L43'>source</a>:char, <a href='081print.mu.html#L4'>screen</a>:&:<a href='081print.mu.html#L4'>screen</a> [ <span id="L355" class="LineNr">355 </span> <span class="Constant">local-scope</span> <span id="L356" class="LineNr">356 </span> <span class="Constant">load-ingredients</span> <span id="L357" class="LineNr">357 </span> c:char, eof?:bool, stdin <span class="Special"><-</span> read stdin @@ -431,8 +431,8 @@ if ('onhashchange' in window) { <span id="L367" class="LineNr">367 </span><span class="muScenario">scenario</span> read-move-blocking [ <span id="L368" class="LineNr">368 </span> <span class="Constant">local-scope</span> <span id="L369" class="LineNr">369 </span> assume-screen <span class="Constant">20/width</span>, <span class="Constant">2/height</span> -<span id="L370" class="LineNr">370 </span> source:&:source:char, sink:&:sink:char <span class="Special"><-</span> <a href='075channel.mu.html#L51'>new-channel</a> <span class="Constant">2/capacity</span> -<span id="L371" class="LineNr">371 </span> read-move-routine:num/routine <span class="Special"><-</span> start-running <a href='chessboard.mu.html#L237'>read-move</a>, source, <a href='081print.mu.html#L4'>screen</a>:&:<a href='081print.mu.html#L4'>screen</a> +<span id="L370" class="LineNr">370 </span> <a href='075channel.mu.html#L43'>source</a>:&:<a href='075channel.mu.html#L43'>source</a>:char, <a href='075channel.mu.html#L47'>sink</a>:&:<a href='075channel.mu.html#L47'>sink</a>:char <span class="Special"><-</span> <a href='075channel.mu.html#L51'>new-channel</a> <span class="Constant">2/capacity</span> +<span id="L371" class="LineNr">371 </span> read-move-routine:num/routine <span class="Special"><-</span> start-running <a href='chessboard.mu.html#L237'>read-move</a>, <a href='075channel.mu.html#L43'>source</a>, <a href='081print.mu.html#L4'>screen</a>:&:<a href='081print.mu.html#L4'>screen</a> <span id="L372" class="LineNr">372 </span> run [ <span id="L373" class="LineNr">373 </span> <span class="Conceal">¦</span> <span class="Comment"># 'read-move' is waiting for input</span> <span id="L374" class="LineNr">374 </span> <span class="Conceal">¦</span> wait-for-routine-to-block read-move-routine @@ -441,7 +441,7 @@ if ('onhashchange' in window) { <span id="L377" class="LineNr">377 </span> <span class="Conceal">¦</span> assert waiting?, <span class="Constant">[ </span> <span id="L378" class="LineNr">378 </span><span class="Constant">F read-move-blocking: routine failed to pause after coming up (before any keys were pressed)]</span> <span id="L379" class="LineNr">379 </span> <span class="Conceal">¦</span> <span class="Comment"># press 'a'</span> -<span id="L380" class="LineNr">380 </span> <span class="Conceal">¦</span> sink <span class="Special"><-</span> <a href='075channel.mu.html#L66'>write</a> sink, <span class="Constant">97/a</span> +<span id="L380" class="LineNr">380 </span> <span class="Conceal">¦</span> <a href='075channel.mu.html#L47'>sink</a> <span class="Special"><-</span> <a href='075channel.mu.html#L66'>write</a> <a href='075channel.mu.html#L47'>sink</a>, <span class="Constant">97/a</span> <span id="L381" class="LineNr">381 </span> <span class="Conceal">¦</span> restart read-move-routine <span id="L382" class="LineNr">382 </span> <span class="Conceal">¦</span> <span class="Comment"># 'read-move' still waiting for input</span> <span id="L383" class="LineNr">383 </span> <span class="Conceal">¦</span> wait-for-routine-to-block read-move-routine @@ -450,7 +450,7 @@ if ('onhashchange' in window) { <span id="L386" class="LineNr">386 </span> <span class="Conceal">¦</span> assert waiting?, <span class="Constant">[ </span> <span id="L387" class="LineNr">387 </span><span class="Constant">F read-move-blocking: routine failed to pause after rank 'a']</span> <span id="L388" class="LineNr">388 </span> <span class="Conceal">¦</span> <span class="Comment"># press '2'</span> -<span id="L389" class="LineNr">389 </span> <span class="Conceal">¦</span> sink <span class="Special"><-</span> <a href='075channel.mu.html#L66'>write</a> sink, <span class="Constant">50/'2'</span> +<span id="L389" class="LineNr">389 </span> <span class="Conceal">¦</span> <a href='075channel.mu.html#L47'>sink</a> <span class="Special"><-</span> <a href='075channel.mu.html#L66'>write</a> <a href='075channel.mu.html#L47'>sink</a>, <span class="Constant">50/'2'</span> <span id="L390" class="LineNr">390 </span> <span class="Conceal">¦</span> restart read-move-routine <span id="L391" class="LineNr">391 </span> <span class="Conceal">¦</span> <span class="Comment"># 'read-move' still waiting for input</span> <span id="L392" class="LineNr">392 </span> <span class="Conceal">¦</span> wait-for-routine-to-block read-move-routine @@ -459,7 +459,7 @@ if ('onhashchange' in window) { <span id="L395" class="LineNr">395 </span> <span class="Conceal">¦</span> assert waiting?, <span class="Constant">[ </span> <span id="L396" class="LineNr">396 </span><span class="Constant">F read-move-blocking: routine failed to pause after file 'a2']</span> <span id="L397" class="LineNr">397 </span> <span class="Conceal">¦</span> <span class="Comment"># press '-'</span> -<span id="L398" class="LineNr">398 </span> <span class="Conceal">¦</span> sink <span class="Special"><-</span> <a href='075channel.mu.html#L66'>write</a> sink, <span class="Constant">45/'-'</span> +<span id="L398" class="LineNr">398 </span> <span class="Conceal">¦</span> <a href='075channel.mu.html#L47'>sink</a> <span class="Special"><-</span> <a href='075channel.mu.html#L66'>write</a> <a href='075channel.mu.html#L47'>sink</a>, <span class="Constant">45/'-'</span> <span id="L399" class="LineNr">399 </span> <span class="Conceal">¦</span> restart read-move-routine <span id="L400" class="LineNr">400 </span> <span class="Conceal">¦</span> <span class="Comment"># 'read-move' still waiting for input</span> <span id="L401" class="LineNr">401 </span> <span class="Conceal">¦</span> wait-for-routine-to-block read-move-routine @@ -468,7 +468,7 @@ if ('onhashchange' in window) { <span id="L404" class="LineNr">404 </span> <span class="Conceal">¦</span> assert waiting?, <span class="Constant">[ </span> <span id="L405" class="LineNr">405 </span><span class="Constant">F read-move-blocking: routine failed to pause after hyphen 'a2-']</span> <span id="L406" class="LineNr">406 </span> <span class="Conceal">¦</span> <span class="Comment"># press 'a'</span> -<span id="L407" class="LineNr">407 </span> <span class="Conceal">¦</span> sink <span class="Special"><-</span> <a href='075channel.mu.html#L66'>write</a> sink, <span class="Constant">97/a</span> +<span id="L407" class="LineNr">407 </span> <span class="Conceal">¦</span> <a href='075channel.mu.html#L47'>sink</a> <span class="Special"><-</span> <a href='075channel.mu.html#L66'>write</a> <a href='075channel.mu.html#L47'>sink</a>, <span class="Constant">97/a</span> <span id="L408" class="LineNr">408 </span> <span class="Conceal">¦</span> restart read-move-routine <span id="L409" class="LineNr">409 </span> <span class="Conceal">¦</span> <span class="Comment"># 'read-move' still waiting for input</span> <span id="L410" class="LineNr">410 </span> <span class="Conceal">¦</span> wait-for-routine-to-block read-move-routine @@ -477,7 +477,7 @@ if ('onhashchange' in window) { <span id="L413" class="LineNr">413 </span> <span class="Conceal">¦</span> assert waiting?, <span class="Constant">[ </span> <span id="L414" class="LineNr">414 </span><span class="Constant">F read-move-blocking: routine failed to pause after rank 'a2-a']</span> <span id="L415" class="LineNr">415 </span> <span class="Conceal">¦</span> <span class="Comment"># press '4'</span> -<span id="L416" class="LineNr">416 </span> <span class="Conceal">¦</span> sink <span class="Special"><-</span> <a href='075channel.mu.html#L66'>write</a> sink, <span class="Constant">52/'4'</span> +<span id="L416" class="LineNr">416 </span> <span class="Conceal">¦</span> <a href='075channel.mu.html#L47'>sink</a> <span class="Special"><-</span> <a href='075channel.mu.html#L66'>write</a> <a href='075channel.mu.html#L47'>sink</a>, <span class="Constant">52/'4'</span> <span id="L417" class="LineNr">417 </span> <span class="Conceal">¦</span> restart read-move-routine <span id="L418" class="LineNr">418 </span> <span class="Conceal">¦</span> <span class="Comment"># 'read-move' still waiting for input</span> <span id="L419" class="LineNr">419 </span> <span class="Conceal">¦</span> wait-for-routine-to-block read-move-routine @@ -486,7 +486,7 @@ if ('onhashchange' in window) { <span id="L422" class="LineNr">422 </span> <span class="Conceal">¦</span> assert waiting?, <span class="Constant">[ </span> <span id="L423" class="LineNr">423 </span><span class="Constant">F read-move-blocking: routine failed to pause after file 'a2-a4']</span> <span id="L424" class="LineNr">424 </span> <span class="Conceal">¦</span> <span class="Comment"># press 'newline'</span> -<span id="L425" class="LineNr">425 </span> <span class="Conceal">¦</span> sink <span class="Special"><-</span> <a href='075channel.mu.html#L66'>write</a> sink,<span class="Constant"> 10</span> <span class="Comment"># newline</span> +<span id="L425" class="LineNr">425 </span> <span class="Conceal">¦</span> <a href='075channel.mu.html#L47'>sink</a> <span class="Special"><-</span> <a href='075channel.mu.html#L66'>write</a> <a href='075channel.mu.html#L47'>sink</a>,<span class="Constant"> 10</span> <span class="Comment"># newline</span> <span id="L426" class="LineNr">426 </span> <span class="Conceal">¦</span> restart read-move-routine <span id="L427" class="LineNr">427 </span> <span class="Conceal">¦</span> <span class="Comment"># 'read-move' now completes</span> <span id="L428" class="LineNr">428 </span> <span class="Conceal">¦</span> wait-for-routine-to-block read-move-routine @@ -504,8 +504,8 @@ if ('onhashchange' in window) { <span id="L440" class="LineNr">440 </span><span class="muScenario">scenario</span> read-move-quit [ <span id="L441" class="LineNr">441 </span> <span class="Constant">local-scope</span> <span id="L442" class="LineNr">442 </span> assume-screen <span class="Constant">20/width</span>, <span class="Constant">2/height</span> -<span id="L443" class="LineNr">443 </span> source:&:source:char, sink:&:sink:char <span class="Special"><-</span> <a href='075channel.mu.html#L51'>new-channel</a> <span class="Constant">2/capacity</span> -<span id="L444" class="LineNr">444 </span> read-move-routine:num <span class="Special"><-</span> start-running <a href='chessboard.mu.html#L237'>read-move</a>, source, <a href='081print.mu.html#L4'>screen</a>:&:<a href='081print.mu.html#L4'>screen</a> +<span id="L443" class="LineNr">443 </span> <a href='075channel.mu.html#L43'>source</a>:&:<a href='075channel.mu.html#L43'>source</a>:char, <a href='075channel.mu.html#L47'>sink</a>:&:<a href='075channel.mu.html#L47'>sink</a>:char <span class="Special"><-</span> <a href='075channel.mu.html#L51'>new-channel</a> <span class="Constant">2/capacity</span> +<span id="L444" class="LineNr">444 </span> read-move-routine:num <span class="Special"><-</span> start-running <a href='chessboard.mu.html#L237'>read-move</a>, <a href='075channel.mu.html#L43'>source</a>, <a href='081print.mu.html#L4'>screen</a>:&:<a href='081print.mu.html#L4'>screen</a> <span id="L445" class="LineNr">445 </span> run [ <span id="L446" class="LineNr">446 </span> <span class="Conceal">¦</span> <span class="Comment"># 'read-move' is waiting for input</span> <span id="L447" class="LineNr">447 </span> <span class="Conceal">¦</span> wait-for-routine-to-block read-move-routine @@ -514,7 +514,7 @@ if ('onhashchange' in window) { <span id="L450" class="LineNr">450 </span> <span class="Conceal">¦</span> assert waiting?, <span class="Constant">[ </span> <span id="L451" class="LineNr">451 </span><span class="Constant">F read-move-quit: routine failed to pause after coming up (before any keys were pressed)]</span> <span id="L452" class="LineNr">452 </span> <span class="Conceal">¦</span> <span class="Comment"># press 'q'</span> -<span id="L453" class="LineNr">453 </span> <span class="Conceal">¦</span> sink <span class="Special"><-</span> <a href='075channel.mu.html#L66'>write</a> sink, <span class="Constant">113/q</span> +<span id="L453" class="LineNr">453 </span> <span class="Conceal">¦</span> <a href='075channel.mu.html#L47'>sink</a> <span class="Special"><-</span> <a href='075channel.mu.html#L66'>write</a> <a href='075channel.mu.html#L47'>sink</a>, <span class="Constant">113/q</span> <span id="L454" class="LineNr">454 </span> <span class="Conceal">¦</span> restart read-move-routine <span id="L455" class="LineNr">455 </span> <span class="Conceal">¦</span> <span class="Comment"># 'read-move' completes</span> <span id="L456" class="LineNr">456 </span> <span class="Conceal">¦</span> wait-for-routine-to-block read-move-routine @@ -532,8 +532,8 @@ if ('onhashchange' in window) { <span id="L468" class="LineNr">468 </span><span class="muScenario">scenario</span> read-move-illegal-file [ <span id="L469" class="LineNr">469 </span> <span class="Constant">local-scope</span> <span id="L470" class="LineNr">470 </span> assume-screen <span class="Constant">20/width</span>, <span class="Constant">2/height</span> -<span id="L471" class="LineNr">471 </span> source:&:source:char, sink:&:sink:char <span class="Special"><-</span> <a href='075channel.mu.html#L51'>new-channel</a> <span class="Constant">2/capacity</span> -<span id="L472" class="LineNr">472 </span> read-move-routine:num <span class="Special"><-</span> start-running <a href='chessboard.mu.html#L237'>read-move</a>, source, <a href='081print.mu.html#L4'>screen</a>:&:<a href='081print.mu.html#L4'>screen</a> +<span id="L471" class="LineNr">471 </span> <a href='075channel.mu.html#L43'>source</a>:&:<a href='075channel.mu.html#L43'>source</a>:char, <a href='075channel.mu.html#L47'>sink</a>:&:<a href='075channel.mu.html#L47'>sink</a>:char <span class="Special"><-</span> <a href='075channel.mu.html#L51'>new-channel</a> <span class="Constant">2/capacity</span> +<span id="L472" class="LineNr">472 </span> read-move-routine:num <span class="Special"><-</span> start-running <a href='chessboard.mu.html#L237'>read-move</a>, <a href='075channel.mu.html#L43'>source</a>, <a href='081print.mu.html#L4'>screen</a>:&:<a href='081print.mu.html#L4'>screen</a> <span id="L473" class="LineNr">473 </span> run [ <span id="L474" class="LineNr">474 </span> <span class="Conceal">¦</span> <span class="Comment"># 'read-move' is waiting for input</span> <span id="L475" class="LineNr">475 </span> <span class="Conceal">¦</span> wait-for-routine-to-block read-move-routine @@ -541,7 +541,7 @@ if ('onhashchange' in window) { <span id="L477" class="LineNr">477 </span> <span class="Conceal">¦</span> waiting?:bool <span class="Special"><-</span> not-equal read-move-state, <span class="Constant">2/discontinued</span> <span id="L478" class="LineNr">478 </span> <span class="Conceal">¦</span> assert waiting?, <span class="Constant">[ </span> <span id="L479" class="LineNr">479 </span><span class="Constant">F read-move-illegal-file: routine failed to pause after coming up (before any keys were pressed)]</span> -<span id="L480" class="LineNr">480 </span> <span class="Conceal">¦</span> sink <span class="Special"><-</span> <a href='075channel.mu.html#L66'>write</a> sink, <span class="Constant">50/'2'</span> +<span id="L480" class="LineNr">480 </span> <span class="Conceal">¦</span> <a href='075channel.mu.html#L47'>sink</a> <span class="Special"><-</span> <a href='075channel.mu.html#L66'>write</a> <a href='075channel.mu.html#L47'>sink</a>, <span class="Constant">50/'2'</span> <span id="L481" class="LineNr">481 </span> <span class="Conceal">¦</span> restart read-move-routine <span id="L482" class="LineNr">482 </span> <span class="Conceal">¦</span> wait-for-routine-to-block read-move-routine <span id="L483" class="LineNr">483 </span> ] @@ -554,8 +554,8 @@ if ('onhashchange' in window) { <span id="L490" class="LineNr">490 </span><span class="muScenario">scenario</span> read-move-illegal-rank [ <span id="L491" class="LineNr">491 </span> <span class="Constant">local-scope</span> <span id="L492" class="LineNr">492 </span> assume-screen <span class="Constant">20/width</span>, <span class="Constant">2/height</span> -<span id="L493" class="LineNr">493 </span> source:&:source:char, sink:&:sink:char <span class="Special"><-</span> <a href='075channel.mu.html#L51'>new-channel</a> <span class="Constant">2/capacity</span> -<span id="L494" class="LineNr">494 </span> read-move-routine:num <span class="Special"><-</span> start-running <a href='chessboard.mu.html#L237'>read-move</a>, source, <a href='081print.mu.html#L4'>screen</a>:&:<a href='081print.mu.html#L4'>screen</a> +<span id="L493" class="LineNr">493 </span> <a href='075channel.mu.html#L43'>source</a>:&:<a href='075channel.mu.html#L43'>source</a>:char, <a href='075channel.mu.html#L47'>sink</a>:&:<a href='075channel.mu.html#L47'>sink</a>:char <span class="Special"><-</span> <a href='075channel.mu.html#L51'>new-channel</a> <span class="Constant">2/capacity</span> +<span id="L494" class="LineNr">494 </span> read-move-routine:num <span class="Special"><-</span> start-running <a href='chessboard.mu.html#L237'>read-move</a>, <a href='075channel.mu.html#L43'>source</a>, <a href='081print.mu.html#L4'>screen</a>:&:<a href='081print.mu.html#L4'>screen</a> <span id="L495" class="LineNr">495 </span> run [ <span id="L496" class="LineNr">496 </span> <span class="Conceal">¦</span> <span class="Comment"># 'read-move' is waiting for input</span> <span id="L497" class="LineNr">497 </span> <span class="Conceal">¦</span> wait-for-routine-to-block read-move-routine @@ -563,8 +563,8 @@ if ('onhashchange' in window) { <span id="L499" class="LineNr">499 </span> <span class="Conceal">¦</span> waiting?:bool <span class="Special"><-</span> not-equal read-move-state, <span class="Constant">2/discontinued</span> <span id="L500" class="LineNr">500 </span> <span class="Conceal">¦</span> assert waiting?, <span class="Constant">[ </span> <span id="L501" class="LineNr">501 </span><span class="Constant">F read-move-illegal-rank: routine failed to pause after coming up (before any keys were pressed)]</span> -<span id="L502" class="LineNr">502 </span> <span class="Conceal">¦</span> sink <span class="Special"><-</span> <a href='075channel.mu.html#L66'>write</a> sink, <span class="Constant">97/a</span> -<span id="L503" class="LineNr">503 </span> <span class="Conceal">¦</span> sink <span class="Special"><-</span> <a href='075channel.mu.html#L66'>write</a> sink, <span class="Constant">97/a</span> +<span id="L502" class="LineNr">502 </span> <span class="Conceal">¦</span> <a href='075channel.mu.html#L47'>sink</a> <span class="Special"><-</span> <a href='075channel.mu.html#L66'>write</a> <a href='075channel.mu.html#L47'>sink</a>, <span class="Constant">97/a</span> +<span id="L503" class="LineNr">503 </span> <span class="Conceal">¦</span> <a href='075channel.mu.html#L47'>sink</a> <span class="Special"><-</span> <a href='075channel.mu.html#L66'>write</a> <a href='075channel.mu.html#L47'>sink</a>, <span class="Constant">97/a</span> <span id="L504" class="LineNr">504 </span> <span class="Conceal">¦</span> restart read-move-routine <span id="L505" class="LineNr">505 </span> <span class="Conceal">¦</span> wait-for-routine-to-block read-move-routine <span id="L506" class="LineNr">506 </span> ] @@ -577,8 +577,8 @@ if ('onhashchange' in window) { <span id="L513" class="LineNr">513 </span><span class="muScenario">scenario</span> read-move-empty [ <span id="L514" class="LineNr">514 </span> <span class="Constant">local-scope</span> <span id="L515" class="LineNr">515 </span> assume-screen <span class="Constant">20/width</span>, <span class="Constant">2/height</span> -<span id="L516" class="LineNr">516 </span> source:&:source:char, sink:&:sink:char <span class="Special"><-</span> <a href='075channel.mu.html#L51'>new-channel</a> <span class="Constant">2/capacity</span> -<span id="L517" class="LineNr">517 </span> read-move-routine:num <span class="Special"><-</span> start-running <a href='chessboard.mu.html#L237'>read-move</a>, source, <a href='081print.mu.html#L4'>screen</a>:&:<a href='081print.mu.html#L4'>screen</a> +<span id="L516" class="LineNr">516 </span> <a href='075channel.mu.html#L43'>source</a>:&:<a href='075channel.mu.html#L43'>source</a>:char, <a href='075channel.mu.html#L47'>sink</a>:&:<a href='075channel.mu.html#L47'>sink</a>:char <span class="Special"><-</span> <a href='075channel.mu.html#L51'>new-channel</a> <span class="Constant">2/capacity</span> +<span id="L517" class="LineNr">517 </span> read-move-routine:num <span class="Special"><-</span> start-running <a href='chessboard.mu.html#L237'>read-move</a>, <a href='075channel.mu.html#L43'>source</a>, <a href='081print.mu.html#L4'>screen</a>:&:<a href='081print.mu.html#L4'>screen</a> <span id="L518" class="LineNr">518 </span> run [ <span id="L519" class="LineNr">519 </span> <span class="Conceal">¦</span> <span class="Comment"># 'read-move' is waiting for input</span> <span id="L520" class="LineNr">520 </span> <span class="Conceal">¦</span> wait-for-routine-to-block read-move-routine @@ -586,8 +586,8 @@ if ('onhashchange' in window) { <span id="L522" class="LineNr">522 </span> <span class="Conceal">¦</span> waiting?:bool <span class="Special"><-</span> not-equal read-move-state, <span class="Constant">2/discontinued</span> <span id="L523" class="LineNr">523 </span> <span class="Conceal">¦</span> assert waiting?, <span class="Constant">[ </span> <span id="L524" class="LineNr">524 </span><span class="Constant">F read-move-empty: routine failed to pause after coming up (before any keys were pressed)]</span> -<span id="L525" class="LineNr">525 </span> <span class="Conceal">¦</span> sink <span class="Special"><-</span> <a href='075channel.mu.html#L66'>write</a> sink, <span class="Constant">10/newline</span> -<span id="L526" class="LineNr">526 </span> <span class="Conceal">¦</span> sink <span class="Special"><-</span> <a href='075channel.mu.html#L66'>write</a> sink, <span class="Constant">97/a</span> +<span id="L525" class="LineNr">525 </span> <span class="Conceal">¦</span> <a href='075channel.mu.html#L47'>sink</a> <span class="Special"><-</span> <a href='075channel.mu.html#L66'>write</a> <a href='075channel.mu.html#L47'>sink</a>, <span class="Constant">10/newline</span> +<span id="L526" class="LineNr">526 </span> <span class="Conceal">¦</span> <a href='075channel.mu.html#L47'>sink</a> <span class="Special"><-</span> <a href='075channel.mu.html#L66'>write</a> <a href='075channel.mu.html#L47'>sink</a>, <span class="Constant">97/a</span> <span id="L527" class="LineNr">527 </span> <span class="Conceal">¦</span> restart read-move-routine <span id="L528" class="LineNr">528 </span> <span class="Conceal">¦</span> wait-for-routine-to-block read-move-routine <span id="L529" class="LineNr">529 </span> ] diff --git a/html/edit/001-editor.mu.html b/html/edit/001-editor.mu.html index f9282fcc..14307ec2 100644 --- a/html/edit/001-editor.mu.html +++ b/html/edit/001-editor.mu.html @@ -92,11 +92,11 @@ if ('onhashchange' in window) { <span id="L29" class="LineNr"> 29 </span> <span id="L30" class="LineNr"> 30 </span><span class="muData">container</span> editor [ <span id="L31" class="LineNr"> 31 </span> <span class="Comment"># editable text: doubly linked list of characters (head contains a special sentinel)</span> -<span id="L32" class="LineNr"> 32 </span> data:&:duplex-list:char -<span id="L33" class="LineNr"> 33 </span> top-of-screen:&:duplex-list:char -<span id="L34" class="LineNr"> 34 </span> bottom-of-screen:&:duplex-list:char +<span id="L32" class="LineNr"> 32 </span> data:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char +<span id="L33" class="LineNr"> 33 </span> top-of-screen:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char +<span id="L34" class="LineNr"> 34 </span> bottom-of-screen:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span id="L35" class="LineNr"> 35 </span> <span class="Comment"># location before cursor inside data</span> -<span id="L36" class="LineNr"> 36 </span> before-cursor:&:duplex-list:char +<span id="L36" class="LineNr"> 36 </span> before-cursor:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span id="L37" class="LineNr"> 37 </span> <span id="L38" class="LineNr"> 38 </span> <span class="Comment"># raw bounds of display area on screen</span> <span id="L39" class="LineNr"> 39 </span> <span class="Comment"># always displays from row 1 (leaving row 0 for a menu) and at most until bottom of screen</span> @@ -123,7 +123,7 @@ if ('onhashchange' in window) { <span id="L60" class="LineNr"> 60 </span> *result <span class="Special"><-</span> put *result, <span class="Constant">cursor-row:offset</span>, <span class="Constant">1/top</span> <span id="L61" class="LineNr"> 61 </span> *result <span class="Special"><-</span> put *result, <span class="Constant">cursor-column:offset</span>, left <span id="L62" class="LineNr"> 62 </span> <span class="Comment"># initialize empty contents</span> -<span id="L63" class="LineNr"> 63 </span> init:&:duplex-list:char <span class="Special"><-</span> push <span class="Constant">167/§</span>, <span class="Constant">0/tail</span> +<span id="L63" class="LineNr"> 63 </span> init:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> push <span class="Constant">167/§</span>, <span class="Constant">0/tail</span> <span id="L64" class="LineNr"> 64 </span> *result <span class="Special"><-</span> put *result, <span class="Constant">data:offset</span>, init <span id="L65" class="LineNr"> 65 </span> *result <span class="Special"><-</span> put *result, <span class="Constant">top-of-screen:offset</span>, init <span id="L66" class="LineNr"> 66 </span> *result <span class="Special"><-</span> put *result, <span class="Constant">before-cursor:offset</span>, init @@ -140,7 +140,7 @@ if ('onhashchange' in window) { <span id="L77" class="LineNr"> 77 </span> <span class="muControl">return-unless</span> len <span id="L78" class="LineNr"> 78 </span> idx:num <span class="Special"><-</span> copy<span class="Constant"> 0</span> <span id="L79" class="LineNr"> 79 </span> <span class="Comment"># now we can start appending the rest, character by character</span> -<span id="L80" class="LineNr"> 80 </span> curr:&:duplex-list:char <span class="Special"><-</span> get *editor, <span class="Constant">data:offset</span> +<span id="L80" class="LineNr"> 80 </span> curr:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> get *editor, <span class="Constant">data:offset</span> <span id="L81" class="LineNr"> 81 </span> <span class="Delimiter">{</span> <span id="L82" class="LineNr"> 82 </span> <span class="Conceal">¦</span> done?:bool <span class="Special"><-</span> greater-or-equal idx, len <span id="L83" class="LineNr"> 83 </span> <span class="Conceal">¦</span> <span class="muControl">break-if</span> done? @@ -189,8 +189,8 @@ if ('onhashchange' in window) { <span id="L126" class="LineNr">126 </span> <a href='../081print.mu.html#L587'>screen-height</a>:num <span class="Special"><-</span> <a href='../081print.mu.html#L587'>screen-height</a> <a href='../081print.mu.html#L4'>screen</a> <span id="L127" class="LineNr">127 </span> right:num <span class="Special"><-</span> get *editor, <span class="Constant">right:offset</span> <span id="L128" class="LineNr">128 </span> <span class="Comment"># traversing editor</span> -<span id="L129" class="LineNr">129 </span> curr:&:duplex-list:char <span class="Special"><-</span> get *editor, <span class="Constant">top-of-screen:offset</span> -<span id="L130" class="LineNr">130 </span> <a href='../065duplex_list.mu.html#L36'>prev</a>:&:duplex-list:char <span class="Special"><-</span> copy curr <span class="Comment"># just in case curr becomes null and we can't compute prev</span> +<span id="L129" class="LineNr">129 </span> curr:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> get *editor, <span class="Constant">top-of-screen:offset</span> +<span id="L130" class="LineNr">130 </span> <a href='../065duplex_list.mu.html#L36'>prev</a>:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> copy curr <span class="Comment"># just in case curr becomes null and we can't compute prev</span> <span id="L131" class="LineNr">131 </span> curr <span class="Special"><-</span> <a href='../065duplex_list.mu.html#L29'>next</a> curr <span id="L132" class="LineNr">132 </span> <span class="Comment"># traversing screen</span> <span id="L133" class="LineNr">133 </span> color:num <span class="Special"><-</span> copy <span class="Constant">7/white</span> @@ -198,7 +198,7 @@ if ('onhashchange' in window) { <span id="L135" class="LineNr">135 </span> column:num <span class="Special"><-</span> copy left <span id="L136" class="LineNr">136 </span> cursor-row:num <span class="Special"><-</span> get *editor, <span class="Constant">cursor-row:offset</span> <span id="L137" class="LineNr">137 </span> cursor-column:num <span class="Special"><-</span> get *editor, <span class="Constant">cursor-column:offset</span> -<span id="L138" class="LineNr">138 </span> before-cursor:&:duplex-list:char <span class="Special"><-</span> get *editor, <span class="Constant">before-cursor:offset</span> +<span id="L138" class="LineNr">138 </span> before-cursor:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> get *editor, <span class="Constant">before-cursor:offset</span> <span id="L139" class="LineNr">139 </span> <a href='../081print.mu.html#L4'>screen</a> <span class="Special"><-</span> <a href='../081print.mu.html#L435'>move-cursor</a> <a href='../081print.mu.html#L4'>screen</a>, row, column <span id="L140" class="LineNr">140 </span> <span class="Delimiter">{</span> <span id="L141" class="LineNr">141 </span><span class="Constant"> </span><span class="Conceal">¦</span><span class="Constant"> +next-character</span> diff --git a/html/edit/002-typing.mu.html b/html/edit/002-typing.mu.html index 3b48c3cc..ad249e5c 100644 --- a/html/edit/002-typing.mu.html +++ b/html/edit/002-typing.mu.html @@ -141,8 +141,8 @@ if ('onhashchange' in window) { <span id="L78" class="LineNr"> 78 </span> right:num <span class="Special"><-</span> get *editor, <span class="Constant">right:offset</span> <span id="L79" class="LineNr"> 79 </span> <a href='../081print.mu.html#L587'>screen-height</a>:num <span class="Special"><-</span> <a href='../081print.mu.html#L587'>screen-height</a> <a href='../081print.mu.html#L4'>screen</a> <span id="L80" class="LineNr"> 80 </span> <span class="Comment"># count newlines until screen row</span> -<span id="L81" class="LineNr"> 81 </span> curr:&:duplex-list:char <span class="Special"><-</span> get *editor, <span class="Constant">top-of-screen:offset</span> -<span id="L82" class="LineNr"> 82 </span> <a href='../065duplex_list.mu.html#L36'>prev</a>:&:duplex-list:char <span class="Special"><-</span> copy curr <span class="Comment"># just in case curr becomes null and we can't compute prev</span> +<span id="L81" class="LineNr"> 81 </span> curr:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> get *editor, <span class="Constant">top-of-screen:offset</span> +<span id="L82" class="LineNr"> 82 </span> <a href='../065duplex_list.mu.html#L36'>prev</a>:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> copy curr <span class="Comment"># just in case curr becomes null and we can't compute prev</span> <span id="L83" class="LineNr"> 83 </span> curr <span class="Special"><-</span> <a href='../065duplex_list.mu.html#L29'>next</a> curr <span id="L84" class="LineNr"> 84 </span> row:num <span class="Special"><-</span> copy <span class="Constant">1/top</span> <span id="L85" class="LineNr"> 85 </span> column:num <span class="Special"><-</span> copy left @@ -150,7 +150,7 @@ if ('onhashchange' in window) { <span id="L87" class="LineNr"> 87 </span> cursor-row:num <span class="Special"><-</span> copy target-row <span id="L88" class="LineNr"> 88 </span> *editor <span class="Special"><-</span> put *editor, <span class="Constant">cursor-column:offset</span>, target-column <span id="L89" class="LineNr"> 89 </span> cursor-column:num <span class="Special"><-</span> copy target-column -<span id="L90" class="LineNr"> 90 </span> before-cursor:&:duplex-list:char <span class="Special"><-</span> get *editor, <span class="Constant">before-cursor:offset</span> +<span id="L90" class="LineNr"> 90 </span> before-cursor:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> get *editor, <span class="Constant">before-cursor:offset</span> <span id="L91" class="LineNr"> 91 </span> <span class="Delimiter">{</span> <span id="L92" class="LineNr"> 92 </span><span class="Constant"> </span><span class="Conceal">¦</span><span class="Constant"> +next-character</span> <span id="L93" class="LineNr"> 93 </span> <span class="Conceal">¦</span> <span class="muControl">break-unless</span> curr @@ -232,7 +232,7 @@ if ('onhashchange' in window) { <span id="L169" class="LineNr"> 169 </span> <a href='../081print.mu.html#L587'>screen-height</a>:num <span class="Special"><-</span> <a href='../081print.mu.html#L587'>screen-height</a> <a href='../081print.mu.html#L4'>screen</a> <span id="L170" class="LineNr"> 170 </span> left:num <span class="Special"><-</span> get *editor, <span class="Constant">left:offset</span> <span id="L171" class="LineNr"> 171 </span> right:num <span class="Special"><-</span> get *editor, <span class="Constant">right:offset</span> -<span id="L172" class="LineNr"> 172 </span> before-cursor:&:duplex-list:char <span class="Special"><-</span> get *editor, <span class="Constant">before-cursor:offset</span> +<span id="L172" class="LineNr"> 172 </span> before-cursor:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> get *editor, <span class="Constant">before-cursor:offset</span> <span id="L173" class="LineNr"> 173 </span> cursor-row:num <span class="Special"><-</span> get *editor, <span class="Constant">cursor-row:offset</span> <span id="L174" class="LineNr"> 174 </span> cursor-column:num <span class="Special"><-</span> get *editor, <span class="Constant">cursor-column:offset</span> <span id="L175" class="LineNr"> 175 </span> save-row:num <span class="Special"><-</span> copy cursor-row @@ -264,7 +264,7 @@ if ('onhashchange' in window) { <span id="L201" class="LineNr"> 201 </span><span class="muRecipe">def</span> <a href='002-typing.mu.html#L201'>insert-at-cursor</a> editor:&:editor, c:char, <a href='../081print.mu.html#L4'>screen</a>:&:<a href='../081print.mu.html#L4'>screen</a><span class="muRecipe"> -> </span>go-render?:bool, editor:&:editor, <a href='../081print.mu.html#L4'>screen</a>:&:<a href='../081print.mu.html#L4'>screen</a> [ <span id="L202" class="LineNr"> 202 </span> <span class="Constant">local-scope</span> <span id="L203" class="LineNr"> 203 </span> <span class="Constant">load-ingredients</span> -<span id="L204" class="LineNr"> 204 </span> before-cursor:&:duplex-list:char <span class="Special"><-</span> get *editor, <span class="Constant">before-cursor:offset</span> +<span id="L204" class="LineNr"> 204 </span> before-cursor:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> get *editor, <span class="Constant">before-cursor:offset</span> <span id="L205" class="LineNr"> 205 </span> insert c, before-cursor <span id="L206" class="LineNr"> 206 </span> before-cursor <span class="Special"><-</span> <a href='../065duplex_list.mu.html#L29'>next</a> before-cursor <span id="L207" class="LineNr"> 207 </span> *editor <span class="Special"><-</span> put *editor, <span class="Constant">before-cursor:offset</span>, before-cursor @@ -281,7 +281,7 @@ if ('onhashchange' in window) { <span id="L218" class="LineNr"> 218 </span> <span class="Comment"># but mostly we'll just move the cursor right</span> <span id="L219" class="LineNr"> 219 </span> cursor-column <span class="Special"><-</span> add cursor-column,<span class="Constant"> 1</span> <span id="L220" class="LineNr"> 220 </span> *editor <span class="Special"><-</span> put *editor, <span class="Constant">cursor-column:offset</span>, cursor-column -<span id="L221" class="LineNr"> 221 </span> <a href='../065duplex_list.mu.html#L29'>next</a>:&:duplex-list:char <span class="Special"><-</span> <a href='../065duplex_list.mu.html#L29'>next</a> before-cursor +<span id="L221" class="LineNr"> 221 </span> <a href='../065duplex_list.mu.html#L29'>next</a>:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> <a href='../065duplex_list.mu.html#L29'>next</a> before-cursor <span id="L222" class="LineNr"> 222 </span> <span class="Delimiter">{</span> <span id="L223" class="LineNr"> 223 </span> <span class="Conceal">¦</span> <span class="Comment"># at end of all text? no need to scroll? just print the character and leave</span> <span id="L224" class="LineNr"> 224 </span> <span class="Conceal">¦</span> at-end?:bool <span class="Special"><-</span> equal <a href='../065duplex_list.mu.html#L29'>next</a>, <span class="Constant">0/null</span> @@ -300,7 +300,7 @@ if ('onhashchange' in window) { <span id="L237" class="LineNr"> 237 </span> <span class="Conceal">¦</span> <span class="muControl">break-unless</span> <a href='../065duplex_list.mu.html#L29'>next</a> <span id="L238" class="LineNr"> 238 </span> <span class="Conceal">¦</span> at-right?:bool <span class="Special"><-</span> greater-or-equal cursor-column, <a href='../081print.mu.html#L574'>screen-width</a> <span id="L239" class="LineNr"> 239 </span> <span class="Conceal">¦</span> <span class="muControl">break-if</span> at-right? -<span id="L240" class="LineNr"> 240 </span> <span class="Conceal">¦</span> curr:&:duplex-list:char <span class="Special"><-</span> copy before-cursor +<span id="L240" class="LineNr"> 240 </span> <span class="Conceal">¦</span> curr:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> copy before-cursor <span id="L241" class="LineNr"> 241 </span> <span class="Conceal">¦</span> <a href='../081print.mu.html#L435'>move-cursor</a> <a href='../081print.mu.html#L4'>screen</a>, save-row, save-column <span id="L242" class="LineNr"> 242 </span> <span class="Conceal">¦</span> curr-column:num <span class="Special"><-</span> copy save-column <span id="L243" class="LineNr"> 243 </span> <span class="Conceal">¦</span> <span class="Delimiter">{</span> @@ -760,7 +760,7 @@ if ('onhashchange' in window) { <span id="L697" class="LineNr"> 697 </span> <span class="Conceal">¦</span> before-wrap-column:num <span class="Special"><-</span> subtract wrap-column,<span class="Constant"> 1</span> <span id="L698" class="LineNr"> 698 </span> <span class="Conceal">¦</span> at-wrap?:bool <span class="Special"><-</span> greater-or-equal cursor-column, wrap-column <span id="L699" class="LineNr"> 699 </span> <span class="Conceal">¦</span> just-before-wrap?:bool <span class="Special"><-</span> greater-or-equal cursor-column, before-wrap-column -<span id="L700" class="LineNr"> 700 </span> <span class="Conceal">¦</span> <a href='../065duplex_list.mu.html#L29'>next</a>:&:duplex-list:char <span class="Special"><-</span> <a href='../065duplex_list.mu.html#L29'>next</a> before-cursor +<span id="L700" class="LineNr"> 700 </span> <span class="Conceal">¦</span> <a href='../065duplex_list.mu.html#L29'>next</a>:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> <a href='../065duplex_list.mu.html#L29'>next</a> before-cursor <span id="L701" class="LineNr"> 701 </span> <span class="Conceal">¦</span> <span class="Comment"># at end of line? next == 0 || next.value == 10/newline</span> <span id="L702" class="LineNr"> 702 </span> <span class="Conceal">¦</span> at-end-of-line?:bool <span class="Special"><-</span> equal <a href='../065duplex_list.mu.html#L29'>next</a>,<span class="Constant"> 0</span> <span id="L703" class="LineNr"> 703 </span> <span class="Conceal">¦</span> <span class="Delimiter">{</span> @@ -929,7 +929,7 @@ if ('onhashchange' in window) { <span id="L866" class="LineNr"> 866 </span> <span class="Constant">load-ingredients</span> <span id="L867" class="LineNr"> 867 </span> cursor-row:num <span class="Special"><-</span> get *editor, <span class="Constant">cursor-row:offset</span> <span id="L868" class="LineNr"> 868 </span> cursor-column:num <span class="Special"><-</span> get *editor, <span class="Constant">cursor-column:offset</span> -<span id="L869" class="LineNr"> 869 </span> before-cursor:&:duplex-list:char <span class="Special"><-</span> get *editor, <span class="Constant">before-cursor:offset</span> +<span id="L869" class="LineNr"> 869 </span> before-cursor:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> get *editor, <span class="Constant">before-cursor:offset</span> <span id="L870" class="LineNr"> 870 </span> left:num <span class="Special"><-</span> get *editor, <span class="Constant">left:offset</span> <span id="L871" class="LineNr"> 871 </span> right:num <span class="Special"><-</span> get *editor, <span class="Constant">right:offset</span> <span id="L872" class="LineNr"> 872 </span> <a href='../081print.mu.html#L587'>screen-height</a>:num <span class="Special"><-</span> <a href='../081print.mu.html#L587'>screen-height</a> <a href='../081print.mu.html#L4'>screen</a> @@ -952,8 +952,8 @@ if ('onhashchange' in window) { <span id="L889" class="LineNr"> 889 </span> <span class="Comment"># indent if necessary</span> <span id="L890" class="LineNr"> 890 </span> indent?:bool <span class="Special"><-</span> get *editor, <span class="Constant">indent?:offset</span> <span id="L891" class="LineNr"> 891 </span> <span class="muControl">return-unless</span> indent? -<span id="L892" class="LineNr"> 892 </span> d:&:duplex-list:char <span class="Special"><-</span> get *editor, <span class="Constant">data:offset</span> -<span id="L893" class="LineNr"> 893 </span> end-of-previous-line:&:duplex-list:char <span class="Special"><-</span> <a href='../065duplex_list.mu.html#L36'>prev</a> before-cursor +<span id="L892" class="LineNr"> 892 </span> d:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> get *editor, <span class="Constant">data:offset</span> +<span id="L893" class="LineNr"> 893 </span> end-of-previous-line:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> <a href='../065duplex_list.mu.html#L36'>prev</a> before-cursor <span id="L894" class="LineNr"> 894 </span> indent:num <span class="Special"><-</span> <a href='002-typing.mu.html#L907'>line-indent</a> end-of-previous-line, d <span id="L895" class="LineNr"> 895 </span> i:num <span class="Special"><-</span> copy<span class="Constant"> 0</span> <span id="L896" class="LineNr"> 896 </span> <span class="Delimiter">{</span> @@ -967,7 +967,7 @@ if ('onhashchange' in window) { <span id="L904" class="LineNr"> 904 </span> <span id="L905" class="LineNr"> 905 </span><span class="Comment"># takes a pointer 'curr' into the doubly-linked list and its sentinel, counts</span> <span id="L906" class="LineNr"> 906 </span><span class="Comment"># the number of spaces at the start of the line containing 'curr'.</span> -<span id="L907" class="LineNr"> 907 </span><span class="muRecipe">def</span> <a href='002-typing.mu.html#L907'>line-indent</a> curr:&:duplex-list:char, start:&:duplex-list:char<span class="muRecipe"> -> </span>result:num [ +<span id="L907" class="LineNr"> 907 </span><span class="muRecipe">def</span> <a href='002-typing.mu.html#L907'>line-indent</a> curr:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char, start:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char<span class="muRecipe"> -> </span>result:num [ <span id="L908" class="LineNr"> 908 </span> <span class="Constant">local-scope</span> <span id="L909" class="LineNr"> 909 </span> <span class="Constant">load-ingredients</span> <span id="L910" class="LineNr"> 910 </span> result:num <span class="Special"><-</span> copy<span class="Constant"> 0</span> diff --git a/html/edit/003-shortcuts.mu.html b/html/edit/003-shortcuts.mu.html index c1fd5eca..83871010 100644 --- a/html/edit/003-shortcuts.mu.html +++ b/html/edit/003-shortcuts.mu.html @@ -133,7 +133,7 @@ if ('onhashchange' in window) { <span id="L71" class="LineNr"> 71 </span> <span class="Conceal">¦</span> delete-previous-character?:bool <span class="Special"><-</span> equal c, <span class="Constant">8/backspace</span> <span id="L72" class="LineNr"> 72 </span> <span class="Conceal">¦</span> <span class="muControl">break-unless</span> delete-previous-character? <span id="L73" class="LineNr"> 73 </span><span class="Constant"> </span><span class="Conceal">¦</span><span class="Constant"> <a href='003-shortcuts.mu.html#L73'><backspace-character-begin></a></span> -<span id="L74" class="LineNr"> 74 </span> <span class="Conceal">¦</span> go-render?:bool, backspaced-cell:&:duplex-list:char <span class="Special"><-</span> <a href='003-shortcuts.mu.html#L83'>delete-before-cursor</a> editor, <a href='../081print.mu.html#L4'>screen</a> +<span id="L74" class="LineNr"> 74 </span> <span class="Conceal">¦</span> go-render?:bool, backspaced-cell:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> <a href='003-shortcuts.mu.html#L83'>delete-before-cursor</a> editor, <a href='../081print.mu.html#L4'>screen</a> <span id="L75" class="LineNr"> 75 </span><span class="Constant"> </span><span class="Conceal">¦</span><span class="Constant"> <a href='003-shortcuts.mu.html#L75'><backspace-character-end></a></span> <span id="L76" class="LineNr"> 76 </span> <span class="Conceal">¦</span> <span class="muControl">return</span> <span id="L77" class="LineNr"> 77 </span> <span class="Delimiter">}</span> @@ -142,18 +142,18 @@ if ('onhashchange' in window) { <span id="L80" class="LineNr"> 80 </span><span class="Comment"># return values:</span> <span id="L81" class="LineNr"> 81 </span><span class="Comment"># go-render? - whether caller needs to update the screen</span> <span id="L82" class="LineNr"> 82 </span><span class="Comment"># backspaced-cell - value deleted (or 0 if nothing was deleted) so we can save it for undo, etc.</span> -<span id="L83" class="LineNr"> 83 </span><span class="muRecipe">def</span> <a href='003-shortcuts.mu.html#L83'>delete-before-cursor</a> editor:&:editor, <a href='../081print.mu.html#L4'>screen</a>:&:<a href='../081print.mu.html#L4'>screen</a><span class="muRecipe"> -> </span>go-render?:bool, backspaced-cell:&:duplex-list:char, editor:&:editor, <a href='../081print.mu.html#L4'>screen</a>:&:<a href='../081print.mu.html#L4'>screen</a> [ +<span id="L83" class="LineNr"> 83 </span><span class="muRecipe">def</span> <a href='003-shortcuts.mu.html#L83'>delete-before-cursor</a> editor:&:editor, <a href='../081print.mu.html#L4'>screen</a>:&:<a href='../081print.mu.html#L4'>screen</a><span class="muRecipe"> -> </span>go-render?:bool, backspaced-cell:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char, editor:&:editor, <a href='../081print.mu.html#L4'>screen</a>:&:<a href='../081print.mu.html#L4'>screen</a> [ <span id="L84" class="LineNr"> 84 </span> <span class="Constant">local-scope</span> <span id="L85" class="LineNr"> 85 </span> <span class="Constant">load-ingredients</span> -<span id="L86" class="LineNr"> 86 </span> before-cursor:&:duplex-list:char <span class="Special"><-</span> get *editor, <span class="Constant">before-cursor:offset</span> -<span id="L87" class="LineNr"> 87 </span> data:&:duplex-list:char <span class="Special"><-</span> get *editor, <span class="Constant">data:offset</span> +<span id="L86" class="LineNr"> 86 </span> before-cursor:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> get *editor, <span class="Constant">before-cursor:offset</span> +<span id="L87" class="LineNr"> 87 </span> data:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> get *editor, <span class="Constant">data:offset</span> <span id="L88" class="LineNr"> 88 </span> <span class="Comment"># if at start of text (before-cursor at § sentinel), return</span> -<span id="L89" class="LineNr"> 89 </span> <a href='../065duplex_list.mu.html#L36'>prev</a>:&:duplex-list:char <span class="Special"><-</span> <a href='../065duplex_list.mu.html#L36'>prev</a> before-cursor +<span id="L89" class="LineNr"> 89 </span> <a href='../065duplex_list.mu.html#L36'>prev</a>:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> <a href='../065duplex_list.mu.html#L36'>prev</a> before-cursor <span id="L90" class="LineNr"> 90 </span> <span class="muControl">return-unless</span> <a href='../065duplex_list.mu.html#L36'>prev</a>, <span class="Constant">0/no-more-render</span>, <span class="Constant">0/nothing-deleted</span> <span id="L91" class="LineNr"> 91 </span> trace<span class="Constant"> 10</span>, <span class="Constant">[app]</span>, <span class="Constant">[delete-before-cursor]</span> <span id="L92" class="LineNr"> 92 </span> original-row:num <span class="Special"><-</span> get *editor, <span class="Constant">cursor-row:offset</span> <span id="L93" class="LineNr"> 93 </span> scroll?:bool <span class="Special"><-</span> <a href='003-shortcuts.mu.html#L130'>move-cursor-coordinates-left</a> editor -<span id="L94" class="LineNr"> 94 </span> backspaced-cell:&:duplex-list:char <span class="Special"><-</span> copy before-cursor +<span id="L94" class="LineNr"> 94 </span> backspaced-cell:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> copy before-cursor <span id="L95" class="LineNr"> 95 </span> data <span class="Special"><-</span> remove before-cursor, data <span class="Comment"># will also neatly trim next/prev pointers in backspaced-cell/before-cursor</span> <span id="L96" class="LineNr"> 96 </span> before-cursor <span class="Special"><-</span> copy <a href='../065duplex_list.mu.html#L36'>prev</a> <span id="L97" class="LineNr"> 97 </span> *editor <span class="Special"><-</span> put *editor, <span class="Constant">before-cursor:offset</span>, before-cursor @@ -166,7 +166,7 @@ if ('onhashchange' in window) { <span id="L104" class="LineNr"> 104 </span> <span class="muControl">return-unless</span> same-row?, <span class="Constant">1/go-render</span> <span id="L105" class="LineNr"> 105 </span> left:num <span class="Special"><-</span> get *editor, <span class="Constant">left:offset</span> <span id="L106" class="LineNr"> 106 </span> right:num <span class="Special"><-</span> get *editor, <span class="Constant">right:offset</span> -<span id="L107" class="LineNr"> 107 </span> curr:&:duplex-list:char <span class="Special"><-</span> <a href='../065duplex_list.mu.html#L29'>next</a> before-cursor +<span id="L107" class="LineNr"> 107 </span> curr:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> <a href='../065duplex_list.mu.html#L29'>next</a> before-cursor <span id="L108" class="LineNr"> 108 </span> <a href='../081print.mu.html#L4'>screen</a> <span class="Special"><-</span> <a href='../081print.mu.html#L435'>move-cursor</a> <a href='../081print.mu.html#L4'>screen</a>, cursor-row, cursor-column <span id="L109" class="LineNr"> 109 </span> curr-column:num <span class="Special"><-</span> copy cursor-column <span id="L110" class="LineNr"> 110 </span> <span class="Delimiter">{</span> @@ -193,7 +193,7 @@ if ('onhashchange' in window) { <span id="L131" class="LineNr"> 131 </span> <span class="Constant">local-scope</span> <span id="L132" class="LineNr"> 132 </span> <span class="Constant">load-ingredients</span> <span id="L133" class="LineNr"> 133 </span> go-render?:bool <span class="Special"><-</span> copy <span class="Constant">0/false</span> -<span id="L134" class="LineNr"> 134 </span> before-cursor:&:duplex-list:char <span class="Special"><-</span> get *editor, <span class="Constant">before-cursor:offset</span> +<span id="L134" class="LineNr"> 134 </span> before-cursor:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> get *editor, <span class="Constant">before-cursor:offset</span> <span id="L135" class="LineNr"> 135 </span> cursor-row:num <span class="Special"><-</span> get *editor, <span class="Constant">cursor-row:offset</span> <span id="L136" class="LineNr"> 136 </span> cursor-column:num <span class="Special"><-</span> get *editor, <span class="Constant">cursor-column:offset</span> <span id="L137" class="LineNr"> 137 </span> left:num <span class="Special"><-</span> get *editor, <span class="Constant">left:offset</span> @@ -225,7 +225,7 @@ if ('onhashchange' in window) { <span id="L163" class="LineNr"> 163 </span> <span class="Conceal">¦</span> <span class="muControl">break-unless</span> previous-character-is-newline? <span id="L164" class="LineNr"> 164 </span> <span class="Conceal">¦</span> <span class="Comment"># compute length of previous line</span> <span id="L165" class="LineNr"> 165 </span> <span class="Conceal">¦</span> trace<span class="Constant"> 10</span>, <span class="Constant">[app]</span>, <span class="Constant">[switching to previous line]</span> -<span id="L166" class="LineNr"> 166 </span> <span class="Conceal">¦</span> d:&:duplex-list:char <span class="Special"><-</span> get *editor, <span class="Constant">data:offset</span> +<span id="L166" class="LineNr"> 166 </span> <span class="Conceal">¦</span> d:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> get *editor, <span class="Constant">data:offset</span> <span id="L167" class="LineNr"> 167 </span> <span class="Conceal">¦</span> end-of-line:num <span class="Special"><-</span> <a href='003-shortcuts.mu.html#L193'>previous-line-length</a> before-cursor, d <span id="L168" class="LineNr"> 168 </span> <span class="Conceal">¦</span> right:num <span class="Special"><-</span> get *editor, <span class="Constant">right:offset</span> <span id="L169" class="LineNr"> 169 </span> <span class="Conceal">¦</span> width:num <span class="Special"><-</span> subtract right, left @@ -252,7 +252,7 @@ if ('onhashchange' in window) { <span id="L190" class="LineNr"> 190 </span> <span id="L191" class="LineNr"> 191 </span><span class="Comment"># takes a pointer 'curr' into the doubly-linked list and its sentinel, counts</span> <span id="L192" class="LineNr"> 192 </span><span class="Comment"># the length of the previous line before the 'curr' pointer.</span> -<span id="L193" class="LineNr"> 193 </span><span class="muRecipe">def</span> <a href='003-shortcuts.mu.html#L193'>previous-line-length</a> curr:&:duplex-list:char, start:&:duplex-list:char<span class="muRecipe"> -> </span>result:num [ +<span id="L193" class="LineNr"> 193 </span><span class="muRecipe">def</span> <a href='003-shortcuts.mu.html#L193'>previous-line-length</a> curr:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char, start:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char<span class="muRecipe"> -> </span>result:num [ <span id="L194" class="LineNr"> 194 </span> <span class="Constant">local-scope</span> <span id="L195" class="LineNr"> 195 </span> <span class="Constant">load-ingredients</span> <span id="L196" class="LineNr"> 196 </span> result:num <span class="Special"><-</span> copy<span class="Constant"> 0</span> @@ -401,25 +401,25 @@ if ('onhashchange' in window) { <span id="L339" class="LineNr"> 339 </span> <span class="Conceal">¦</span> delete-next-character?:bool <span class="Special"><-</span> equal k, <span class="Constant">65522/delete</span> <span id="L340" class="LineNr"> 340 </span> <span class="Conceal">¦</span> <span class="muControl">break-unless</span> delete-next-character? <span id="L341" class="LineNr"> 341 </span><span class="Constant"> </span><span class="Conceal">¦</span><span class="Constant"> <a href='003-shortcuts.mu.html#L341'><delete-character-begin></a></span> -<span id="L342" class="LineNr"> 342 </span> <span class="Conceal">¦</span> go-render?:bool, deleted-cell:&:duplex-list:char <span class="Special"><-</span> <a href='003-shortcuts.mu.html#L348'>delete-at-cursor</a> editor, <a href='../081print.mu.html#L4'>screen</a> +<span id="L342" class="LineNr"> 342 </span> <span class="Conceal">¦</span> go-render?:bool, deleted-cell:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> <a href='003-shortcuts.mu.html#L348'>delete-at-cursor</a> editor, <a href='../081print.mu.html#L4'>screen</a> <span id="L343" class="LineNr"> 343 </span><span class="Constant"> </span><span class="Conceal">¦</span><span class="Constant"> <a href='003-shortcuts.mu.html#L343'><delete-character-end></a></span> <span id="L344" class="LineNr"> 344 </span> <span class="Conceal">¦</span> <span class="muControl">return</span> <span id="L345" class="LineNr"> 345 </span> <span class="Delimiter">}</span> <span id="L346" class="LineNr"> 346 </span>] <span id="L347" class="LineNr"> 347 </span> -<span id="L348" class="LineNr"> 348 </span><span class="muRecipe">def</span> <a href='003-shortcuts.mu.html#L348'>delete-at-cursor</a> editor:&:editor, <a href='../081print.mu.html#L4'>screen</a>:&:<a href='../081print.mu.html#L4'>screen</a><span class="muRecipe"> -> </span>go-render?:bool, deleted-cell:&:duplex-list:char, editor:&:editor, <a href='../081print.mu.html#L4'>screen</a>:&:<a href='../081print.mu.html#L4'>screen</a> [ +<span id="L348" class="LineNr"> 348 </span><span class="muRecipe">def</span> <a href='003-shortcuts.mu.html#L348'>delete-at-cursor</a> editor:&:editor, <a href='../081print.mu.html#L4'>screen</a>:&:<a href='../081print.mu.html#L4'>screen</a><span class="muRecipe"> -> </span>go-render?:bool, deleted-cell:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char, editor:&:editor, <a href='../081print.mu.html#L4'>screen</a>:&:<a href='../081print.mu.html#L4'>screen</a> [ <span id="L349" class="LineNr"> 349 </span> <span class="Constant">local-scope</span> <span id="L350" class="LineNr"> 350 </span> <span class="Constant">load-ingredients</span> -<span id="L351" class="LineNr"> 351 </span> before-cursor:&:duplex-list:char <span class="Special"><-</span> get *editor, <span class="Constant">before-cursor:offset</span> -<span id="L352" class="LineNr"> 352 </span> data:&:duplex-list:char <span class="Special"><-</span> get *editor, <span class="Constant">data:offset</span> -<span id="L353" class="LineNr"> 353 </span> deleted-cell:&:duplex-list:char <span class="Special"><-</span> <a href='../065duplex_list.mu.html#L29'>next</a> before-cursor +<span id="L351" class="LineNr"> 351 </span> before-cursor:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> get *editor, <span class="Constant">before-cursor:offset</span> +<span id="L352" class="LineNr"> 352 </span> data:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> get *editor, <span class="Constant">data:offset</span> +<span id="L353" class="LineNr"> 353 </span> deleted-cell:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> <a href='../065duplex_list.mu.html#L29'>next</a> before-cursor <span id="L354" class="LineNr"> 354 </span> <span class="muControl">return-unless</span> deleted-cell, <span class="Constant">0/don't-render</span> <span id="L355" class="LineNr"> 355 </span> currc:char <span class="Special"><-</span> get *deleted-cell, <span class="Constant">value:offset</span> <span id="L356" class="LineNr"> 356 </span> data <span class="Special"><-</span> remove deleted-cell, data <span id="L357" class="LineNr"> 357 </span> deleted-newline?:bool <span class="Special"><-</span> equal currc, <span class="Constant">10/newline</span> <span id="L358" class="LineNr"> 358 </span> <span class="muControl">return-if</span> deleted-newline?, <span class="Constant">1/go-render</span> <span id="L359" class="LineNr"> 359 </span> <span class="Comment"># wasn't a newline? render rest of line</span> -<span id="L360" class="LineNr"> 360 </span> curr:&:duplex-list:char <span class="Special"><-</span> <a href='../065duplex_list.mu.html#L29'>next</a> before-cursor <span class="Comment"># refresh after remove above</span> +<span id="L360" class="LineNr"> 360 </span> curr:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> <a href='../065duplex_list.mu.html#L29'>next</a> before-cursor <span class="Comment"># refresh after remove above</span> <span id="L361" class="LineNr"> 361 </span> cursor-row:num <span class="Special"><-</span> get *editor, <span class="Constant">cursor-row:offset</span> <span id="L362" class="LineNr"> 362 </span> cursor-column:num <span class="Special"><-</span> get *editor, <span class="Constant">cursor-column:offset</span> <span id="L363" class="LineNr"> 363 </span> <a href='../081print.mu.html#L4'>screen</a> <span class="Special"><-</span> <a href='../081print.mu.html#L435'>move-cursor</a> <a href='../081print.mu.html#L4'>screen</a>, cursor-row, cursor-column @@ -474,7 +474,7 @@ if ('onhashchange' in window) { <span id="L412" class="LineNr"> 412 </span> <span class="Conceal">¦</span> move-to-next-character?:bool <span class="Special"><-</span> equal k, <span class="Constant">65514/right-arrow</span> <span id="L413" class="LineNr"> 413 </span> <span class="Conceal">¦</span> <span class="muControl">break-unless</span> move-to-next-character? <span id="L414" class="LineNr"> 414 </span> <span class="Conceal">¦</span> <span class="Comment"># if not at end of text</span> -<span id="L415" class="LineNr"> 415 </span> <span class="Conceal">¦</span> next-cursor:&:duplex-list:char <span class="Special"><-</span> <a href='../065duplex_list.mu.html#L29'>next</a> before-cursor +<span id="L415" class="LineNr"> 415 </span> <span class="Conceal">¦</span> next-cursor:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> <a href='../065duplex_list.mu.html#L29'>next</a> before-cursor <span id="L416" class="LineNr"> 416 </span> <span class="Conceal">¦</span> <span class="muControl">break-unless</span> next-cursor <span id="L417" class="LineNr"> 417 </span> <span class="Conceal">¦</span> <span class="Comment"># scan to next character</span> <span id="L418" class="LineNr"> 418 </span><span class="Constant"> </span><span class="Conceal">¦</span><span class="Constant"> <move-cursor-begin></span> @@ -491,7 +491,7 @@ if ('onhashchange' in window) { <span id="L429" class="LineNr"> 429 </span><span class="muRecipe">def</span> <a href='003-shortcuts.mu.html#L429'>move-cursor-coordinates-right</a> editor:&:editor, <a href='../081print.mu.html#L587'>screen-height</a>:num<span class="muRecipe"> -> </span>go-render?:bool, editor:&:editor [ <span id="L430" class="LineNr"> 430 </span> <span class="Constant">local-scope</span> <span id="L431" class="LineNr"> 431 </span> <span class="Constant">load-ingredients</span> -<span id="L432" class="LineNr"> 432 </span> before-cursor:&:duplex-list:char <span class="Special"><-</span> get *editor <span class="Constant">before-cursor:offset</span> +<span id="L432" class="LineNr"> 432 </span> before-cursor:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> get *editor <span class="Constant">before-cursor:offset</span> <span id="L433" class="LineNr"> 433 </span> cursor-row:num <span class="Special"><-</span> get *editor, <span class="Constant">cursor-row:offset</span> <span id="L434" class="LineNr"> 434 </span> cursor-column:num <span class="Special"><-</span> get *editor, <span class="Constant">cursor-column:offset</span> <span id="L435" class="LineNr"> 435 </span> left:num <span class="Special"><-</span> get *editor, <span class="Constant">left:offset</span> @@ -519,7 +519,7 @@ if ('onhashchange' in window) { <span id="L457" class="LineNr"> 457 </span> <span class="Conceal">¦</span> at-wrap?:bool <span class="Special"><-</span> equal cursor-column, wrap-column <span id="L458" class="LineNr"> 458 </span> <span class="Conceal">¦</span> <span class="muControl">break-unless</span> at-wrap? <span id="L459" class="LineNr"> 459 </span> <span class="Conceal">¦</span> <span class="Comment"># and if next character isn't newline</span> -<span id="L460" class="LineNr"> 460 </span> <span class="Conceal">¦</span> <a href='../065duplex_list.mu.html#L29'>next</a>:&:duplex-list:char <span class="Special"><-</span> <a href='../065duplex_list.mu.html#L29'>next</a> before-cursor +<span id="L460" class="LineNr"> 460 </span> <span class="Conceal">¦</span> <a href='../065duplex_list.mu.html#L29'>next</a>:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> <a href='../065duplex_list.mu.html#L29'>next</a> before-cursor <span id="L461" class="LineNr"> 461 </span> <span class="Conceal">¦</span> <span class="muControl">break-unless</span> <a href='../065duplex_list.mu.html#L29'>next</a> <span id="L462" class="LineNr"> 462 </span> <span class="Conceal">¦</span> next-character:char <span class="Special"><-</span> get *next, <span class="Constant">value:offset</span> <span id="L463" class="LineNr"> 463 </span> <span class="Conceal">¦</span> newline?:bool <span class="Special"><-</span> equal next-character, <span class="Constant">10/newline</span> @@ -759,7 +759,7 @@ if ('onhashchange' in window) { <span id="L697" class="LineNr"> 697 </span> <span class="Conceal">¦</span> <span class="muControl">break-unless</span> move-to-previous-character? <span id="L698" class="LineNr"> 698 </span> <span class="Conceal">¦</span> trace<span class="Constant"> 10</span>, <span class="Constant">[app]</span>, <span class="Constant">[left arrow]</span> <span id="L699" class="LineNr"> 699 </span> <span class="Conceal">¦</span> <span class="Comment"># if not at start of text (before-cursor at § sentinel)</span> -<span id="L700" class="LineNr"> 700 </span> <span class="Conceal">¦</span> <a href='../065duplex_list.mu.html#L36'>prev</a>:&:duplex-list:char <span class="Special"><-</span> <a href='../065duplex_list.mu.html#L36'>prev</a> before-cursor +<span id="L700" class="LineNr"> 700 </span> <span class="Conceal">¦</span> <a href='../065duplex_list.mu.html#L36'>prev</a>:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> <a href='../065duplex_list.mu.html#L36'>prev</a> before-cursor <span id="L701" class="LineNr"> 701 </span> <span class="Conceal">¦</span> <span class="muControl">return-unless</span> <a href='../065duplex_list.mu.html#L36'>prev</a>, <span class="Constant">0/don't-render</span> <span id="L702" class="LineNr"> 702 </span><span class="Constant"> </span><span class="Conceal">¦</span><span class="Constant"> <move-cursor-begin></span> <span id="L703" class="LineNr"> 703 </span> <span class="Conceal">¦</span> go-render? <span class="Special"><-</span> <a href='003-shortcuts.mu.html#L130'>move-cursor-coordinates-left</a> editor @@ -1041,7 +1041,7 @@ if ('onhashchange' in window) { <span id="L979" class="LineNr"> 979 </span> go-render?:bool <span class="Special"><-</span> copy <span class="Constant">0/false</span> <span id="L980" class="LineNr"> 980 </span> cursor-row:num <span class="Special"><-</span> get *editor, <span class="Constant">cursor-row:offset</span> <span id="L981" class="LineNr"> 981 </span> cursor-column:num <span class="Special"><-</span> get *editor, <span class="Constant">cursor-column:offset</span> -<span id="L982" class="LineNr"> 982 </span> before-cursor:&:duplex-list:char <span class="Special"><-</span> get *editor, <span class="Constant">before-cursor:offset</span> +<span id="L982" class="LineNr"> 982 </span> before-cursor:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> get *editor, <span class="Constant">before-cursor:offset</span> <span id="L983" class="LineNr"> 983 </span> left:num <span class="Special"><-</span> get *editor, <span class="Constant">left:offset</span> <span id="L984" class="LineNr"> 984 </span> right:num <span class="Special"><-</span> get *editor, <span class="Constant">right:offset</span> <span id="L985" class="LineNr"> 985 </span> already-at-top?:bool <span class="Special"><-</span> lesser-or-equal cursor-row, <span class="Constant">1/top</span> @@ -1051,13 +1051,13 @@ if ('onhashchange' in window) { <span id="L989" class="LineNr"> 989 </span> <span class="Conceal">¦</span> <span class="Comment"># if not at newline, move to start of line (previous newline)</span> <span id="L990" class="LineNr"> 990 </span> <span class="Conceal">¦</span> <span class="Comment"># then scan back another line</span> <span id="L991" class="LineNr"> 991 </span> <span class="Conceal">¦</span> <span class="Comment"># if either step fails, give up without modifying cursor or coordinates</span> -<span id="L992" class="LineNr"> 992 </span> <span class="Conceal">¦</span> curr:&:duplex-list:char <span class="Special"><-</span> copy before-cursor +<span id="L992" class="LineNr"> 992 </span> <span class="Conceal">¦</span> curr:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> copy before-cursor <span id="L993" class="LineNr"> 993 </span> <span class="Conceal">¦</span> <span class="Delimiter">{</span> -<span id="L994" class="LineNr"> 994 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> old:&:duplex-list:char <span class="Special"><-</span> copy curr +<span id="L994" class="LineNr"> 994 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> old:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> copy curr <span id="L995" class="LineNr"> 995 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> c2:char <span class="Special"><-</span> get *curr, <span class="Constant">value:offset</span> <span id="L996" class="LineNr"> 996 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> at-newline?:bool <span class="Special"><-</span> equal c2, <span class="Constant">10/newline</span> <span id="L997" class="LineNr"> 997 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="muControl">break-if</span> at-newline? -<span id="L998" class="LineNr"> 998 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> curr:&:duplex-list:char <span class="Special"><-</span> <a href='003-shortcuts.mu.html#L2367'>before-previous-line</a> curr, editor +<span id="L998" class="LineNr"> 998 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> curr:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> <a href='003-shortcuts.mu.html#L2367'>before-previous-line</a> curr, editor <span id="L999" class="LineNr"> 999 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> no-motion?:bool <span class="Special"><-</span> equal curr, old <span id="L1000" class="LineNr">1000 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="muControl">return-if</span> no-motion? <span id="L1001" class="LineNr">1001 </span> <span class="Conceal">¦</span> <span class="Delimiter">}</span> @@ -1078,7 +1078,7 @@ if ('onhashchange' in window) { <span id="L1016" class="LineNr">1016 </span> <span class="Conceal">¦</span> <span class="Delimiter">{</span> <span id="L1017" class="LineNr">1017 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> done?:bool <span class="Special"><-</span> greater-or-equal cursor-column, target-column <span id="L1018" class="LineNr">1018 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="muControl">break-if</span> done? -<span id="L1019" class="LineNr">1019 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> curr:&:duplex-list:char <span class="Special"><-</span> <a href='../065duplex_list.mu.html#L29'>next</a> before-cursor +<span id="L1019" class="LineNr">1019 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> curr:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> <a href='../065duplex_list.mu.html#L29'>next</a> before-cursor <span id="L1020" class="LineNr">1020 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="muControl">break-unless</span> curr <span id="L1021" class="LineNr">1021 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> currc:char <span class="Special"><-</span> get *curr, <span class="Constant">value:offset</span> <span id="L1022" class="LineNr">1022 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> at-newline?:bool <span class="Special"><-</span> equal currc, <span class="Constant">10/newline</span> @@ -1271,7 +1271,7 @@ if ('onhashchange' in window) { <span id="L1209" class="LineNr">1209 </span> <span class="Constant">load-ingredients</span> <span id="L1210" class="LineNr">1210 </span> cursor-row:num <span class="Special"><-</span> get *editor, <span class="Constant">cursor-row:offset</span> <span id="L1211" class="LineNr">1211 </span> cursor-column:num <span class="Special"><-</span> get *editor, <span class="Constant">cursor-column:offset</span> -<span id="L1212" class="LineNr">1212 </span> before-cursor:&:duplex-list:char <span class="Special"><-</span> get *editor, <span class="Constant">before-cursor:offset</span> +<span id="L1212" class="LineNr">1212 </span> before-cursor:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> get *editor, <span class="Constant">before-cursor:offset</span> <span id="L1213" class="LineNr">1213 </span> left:num <span class="Special"><-</span> get *editor, <span class="Constant">left:offset</span> <span id="L1214" class="LineNr">1214 </span> right:num <span class="Special"><-</span> get *editor, <span class="Constant">right:offset</span> <span id="L1215" class="LineNr">1215 </span> last-line:num <span class="Special"><-</span> subtract <a href='../081print.mu.html#L587'>screen-height</a>,<span class="Constant"> 1</span> @@ -1281,7 +1281,7 @@ if ('onhashchange' in window) { <span id="L1219" class="LineNr">1219 </span> <span class="Conceal">¦</span> <span class="muControl">break-if</span> already-at-bottom? <span id="L1220" class="LineNr">1220 </span> <span class="Conceal">¦</span> <span class="Comment"># scan to start of next line, then to right column or until end of line</span> <span id="L1221" class="LineNr">1221 </span> <span class="Conceal">¦</span> max:num <span class="Special"><-</span> subtract right, left -<span id="L1222" class="LineNr">1222 </span> <span class="Conceal">¦</span> next-line:&:duplex-list:char <span class="Special"><-</span> <a href='003-shortcuts.mu.html#L1988'>before-start-of-next-line</a> before-cursor, max +<span id="L1222" class="LineNr">1222 </span> <span class="Conceal">¦</span> next-line:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> <a href='003-shortcuts.mu.html#L1988'>before-start-of-next-line</a> before-cursor, max <span id="L1223" class="LineNr">1223 </span> <span class="Conceal">¦</span> <span class="Delimiter">{</span> <span id="L1224" class="LineNr">1224 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Comment"># already at end of buffer? try to scroll up (so we can see more</span> <span id="L1225" class="LineNr">1225 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Comment"># warnings or sandboxes below)</span> @@ -1301,7 +1301,7 @@ if ('onhashchange' in window) { <span id="L1239" class="LineNr">1239 </span> <span class="Conceal">¦</span> <span class="Delimiter">{</span> <span id="L1240" class="LineNr">1240 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> done?:bool <span class="Special"><-</span> greater-or-equal cursor-column, target-column <span id="L1241" class="LineNr">1241 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="muControl">break-if</span> done? -<span id="L1242" class="LineNr">1242 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> curr:&:duplex-list:char <span class="Special"><-</span> <a href='../065duplex_list.mu.html#L29'>next</a> before-cursor +<span id="L1242" class="LineNr">1242 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> curr:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> <a href='../065duplex_list.mu.html#L29'>next</a> before-cursor <span id="L1243" class="LineNr">1243 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="muControl">break-unless</span> curr <span id="L1244" class="LineNr">1244 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> currc:char <span class="Special"><-</span> get *curr, <span class="Constant">value:offset</span> <span id="L1245" class="LineNr">1245 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> at-newline?:bool <span class="Special"><-</span> equal currc, <span class="Constant">10/newline</span> @@ -1417,8 +1417,8 @@ if ('onhashchange' in window) { <span id="L1355" class="LineNr">1355 </span> cursor-column:num <span class="Special"><-</span> copy left <span id="L1356" class="LineNr">1356 </span> *editor <span class="Special"><-</span> put *editor, <span class="Constant">cursor-column:offset</span>, cursor-column <span id="L1357" class="LineNr">1357 </span> <span class="Comment"># update before-cursor</span> -<span id="L1358" class="LineNr">1358 </span> before-cursor:&:duplex-list:char <span class="Special"><-</span> get *editor, <span class="Constant">before-cursor:offset</span> -<span id="L1359" class="LineNr">1359 </span> init:&:duplex-list:char <span class="Special"><-</span> get *editor, <span class="Constant">data:offset</span> +<span id="L1358" class="LineNr">1358 </span> before-cursor:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> get *editor, <span class="Constant">before-cursor:offset</span> +<span id="L1359" class="LineNr">1359 </span> init:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> get *editor, <span class="Constant">data:offset</span> <span id="L1360" class="LineNr">1360 </span> <span class="Comment"># while not at start of line, move</span> <span id="L1361" class="LineNr">1361 </span> <span class="Delimiter">{</span> <span id="L1362" class="LineNr">1362 </span> <span class="Conceal">¦</span> at-start-of-text?:bool <span class="Special"><-</span> equal before-cursor, init @@ -1586,11 +1586,11 @@ if ('onhashchange' in window) { <span id="L1524" class="LineNr">1524 </span><span class="muRecipe">def</span> <a href='003-shortcuts.mu.html#L1524'>move-to-end-of-line</a> editor:&:editor<span class="muRecipe"> -> </span>editor:&:editor [ <span id="L1525" class="LineNr">1525 </span> <span class="Constant">local-scope</span> <span id="L1526" class="LineNr">1526 </span> <span class="Constant">load-ingredients</span> -<span id="L1527" class="LineNr">1527 </span> before-cursor:&:duplex-list:char <span class="Special"><-</span> get *editor, <span class="Constant">before-cursor:offset</span> +<span id="L1527" class="LineNr">1527 </span> before-cursor:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> get *editor, <span class="Constant">before-cursor:offset</span> <span id="L1528" class="LineNr">1528 </span> cursor-column:num <span class="Special"><-</span> get *editor, <span class="Constant">cursor-column:offset</span> <span id="L1529" class="LineNr">1529 </span> <span class="Comment"># while not at start of line, move</span> <span id="L1530" class="LineNr">1530 </span> <span class="Delimiter">{</span> -<span id="L1531" class="LineNr">1531 </span> <span class="Conceal">¦</span> <a href='../065duplex_list.mu.html#L29'>next</a>:&:duplex-list:char <span class="Special"><-</span> <a href='../065duplex_list.mu.html#L29'>next</a> before-cursor +<span id="L1531" class="LineNr">1531 </span> <span class="Conceal">¦</span> <a href='../065duplex_list.mu.html#L29'>next</a>:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> <a href='../065duplex_list.mu.html#L29'>next</a> before-cursor <span id="L1532" class="LineNr">1532 </span> <span class="Conceal">¦</span> <span class="muControl">break-unless</span> <a href='../065duplex_list.mu.html#L29'>next</a> <span class="Comment"># end of text</span> <span id="L1533" class="LineNr">1533 </span> <span class="Conceal">¦</span> nextc:char <span class="Special"><-</span> get *next, <span class="Constant">value:offset</span> <span id="L1534" class="LineNr">1534 </span> <span class="Conceal">¦</span> at-end-of-line?:bool <span class="Special"><-</span> equal nextc, <span class="Constant">10/newline</span> @@ -1712,20 +1712,20 @@ if ('onhashchange' in window) { <span id="L1650" class="LineNr">1650 </span> <span class="Conceal">¦</span> delete-to-start-of-line?:bool <span class="Special"><-</span> equal c, <span class="Constant">21/ctrl-u</span> <span id="L1651" class="LineNr">1651 </span> <span class="Conceal">¦</span> <span class="muControl">break-unless</span> delete-to-start-of-line? <span id="L1652" class="LineNr">1652 </span><span class="Constant"> </span><span class="Conceal">¦</span><span class="Constant"> <a href='003-shortcuts.mu.html#L1652'><delete-to-start-of-line-begin></a></span> -<span id="L1653" class="LineNr">1653 </span> <span class="Conceal">¦</span> deleted-cells:&:duplex-list:char <span class="Special"><-</span> <a href='003-shortcuts.mu.html#L1659'>delete-to-start-of-line</a> editor +<span id="L1653" class="LineNr">1653 </span> <span class="Conceal">¦</span> deleted-cells:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> <a href='003-shortcuts.mu.html#L1659'>delete-to-start-of-line</a> editor <span id="L1654" class="LineNr">1654 </span><span class="Constant"> </span><span class="Conceal">¦</span><span class="Constant"> <a href='003-shortcuts.mu.html#L1654'><delete-to-start-of-line-end></a></span> <span id="L1655" class="LineNr">1655 </span> <span class="Conceal">¦</span> <span class="muControl">return</span> <span class="Constant">1/go-render</span> <span id="L1656" class="LineNr">1656 </span> <span class="Delimiter">}</span> <span id="L1657" class="LineNr">1657 </span>] <span id="L1658" class="LineNr">1658 </span> -<span id="L1659" class="LineNr">1659 </span><span class="muRecipe">def</span> <a href='003-shortcuts.mu.html#L1659'>delete-to-start-of-line</a> editor:&:editor<span class="muRecipe"> -> </span>result:&:duplex-list:char, editor:&:editor [ +<span id="L1659" class="LineNr">1659 </span><span class="muRecipe">def</span> <a href='003-shortcuts.mu.html#L1659'>delete-to-start-of-line</a> editor:&:editor<span class="muRecipe"> -> </span>result:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char, editor:&:editor [ <span id="L1660" class="LineNr">1660 </span> <span class="Constant">local-scope</span> <span id="L1661" class="LineNr">1661 </span> <span class="Constant">load-ingredients</span> <span id="L1662" class="LineNr">1662 </span> <span class="Comment"># compute range to delete</span> -<span id="L1663" class="LineNr">1663 </span> init:&:duplex-list:char <span class="Special"><-</span> get *editor, <span class="Constant">data:offset</span> -<span id="L1664" class="LineNr">1664 </span> before-cursor:&:duplex-list:char <span class="Special"><-</span> get *editor, <span class="Constant">before-cursor:offset</span> -<span id="L1665" class="LineNr">1665 </span> start:&:duplex-list:char <span class="Special"><-</span> copy before-cursor -<span id="L1666" class="LineNr">1666 </span> end:&:duplex-list:char <span class="Special"><-</span> <a href='../065duplex_list.mu.html#L29'>next</a> before-cursor +<span id="L1663" class="LineNr">1663 </span> init:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> get *editor, <span class="Constant">data:offset</span> +<span id="L1664" class="LineNr">1664 </span> before-cursor:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> get *editor, <span class="Constant">before-cursor:offset</span> +<span id="L1665" class="LineNr">1665 </span> start:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> copy before-cursor +<span id="L1666" class="LineNr">1666 </span> end:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> <a href='../065duplex_list.mu.html#L29'>next</a> before-cursor <span id="L1667" class="LineNr">1667 </span> <span class="Delimiter">{</span> <span id="L1668" class="LineNr">1668 </span> <span class="Conceal">¦</span> at-start-of-text?:bool <span class="Special"><-</span> equal start, init <span id="L1669" class="LineNr">1669 </span> <span class="Conceal">¦</span> <span class="muControl">break-if</span> at-start-of-text? @@ -1737,7 +1737,7 @@ if ('onhashchange' in window) { <span id="L1675" class="LineNr">1675 </span> <span class="Conceal">¦</span> <span class="muControl">loop</span> <span id="L1676" class="LineNr">1676 </span> <span class="Delimiter">}</span> <span id="L1677" class="LineNr">1677 </span> <span class="Comment"># snip it out</span> -<span id="L1678" class="LineNr">1678 </span> result:&:duplex-list:char <span class="Special"><-</span> <a href='../065duplex_list.mu.html#L29'>next</a> start +<span id="L1678" class="LineNr">1678 </span> result:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> <a href='../065duplex_list.mu.html#L29'>next</a> start <span id="L1679" class="LineNr">1679 </span> <a href='../065duplex_list.mu.html#L357'>remove-between</a> start, end <span id="L1680" class="LineNr">1680 </span> <span class="Comment"># adjust cursor</span> <span id="L1681" class="LineNr">1681 </span> before-cursor <span class="Special"><-</span> copy start @@ -1849,18 +1849,18 @@ if ('onhashchange' in window) { <span id="L1787" class="LineNr">1787 </span> <span class="Conceal">¦</span> delete-to-end-of-line?:bool <span class="Special"><-</span> equal c, <span class="Constant">11/ctrl-k</span> <span id="L1788" class="LineNr">1788 </span> <span class="Conceal">¦</span> <span class="muControl">break-unless</span> delete-to-end-of-line? <span id="L1789" class="LineNr">1789 </span><span class="Constant"> </span><span class="Conceal">¦</span><span class="Constant"> <a href='003-shortcuts.mu.html#L1789'><delete-to-end-of-line-begin></a></span> -<span id="L1790" class="LineNr">1790 </span> <span class="Conceal">¦</span> deleted-cells:&:duplex-list:char <span class="Special"><-</span> <a href='003-shortcuts.mu.html#L1796'>delete-to-end-of-line</a> editor +<span id="L1790" class="LineNr">1790 </span> <span class="Conceal">¦</span> deleted-cells:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> <a href='003-shortcuts.mu.html#L1796'>delete-to-end-of-line</a> editor <span id="L1791" class="LineNr">1791 </span><span class="Constant"> </span><span class="Conceal">¦</span><span class="Constant"> <a href='003-shortcuts.mu.html#L1791'><delete-to-end-of-line-end></a></span> <span id="L1792" class="LineNr">1792 </span> <span class="Conceal">¦</span> <span class="muControl">return</span> <span class="Constant">1/go-render</span> <span id="L1793" class="LineNr">1793 </span> <span class="Delimiter">}</span> <span id="L1794" class="LineNr">1794 </span>] <span id="L1795" class="LineNr">1795 </span> -<span id="L1796" class="LineNr">1796 </span><span class="muRecipe">def</span> <a href='003-shortcuts.mu.html#L1796'>delete-to-end-of-line</a> editor:&:editor<span class="muRecipe"> -> </span>result:&:duplex-list:char, editor:&:editor [ +<span id="L1796" class="LineNr">1796 </span><span class="muRecipe">def</span> <a href='003-shortcuts.mu.html#L1796'>delete-to-end-of-line</a> editor:&:editor<span class="muRecipe"> -> </span>result:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char, editor:&:editor [ <span id="L1797" class="LineNr">1797 </span> <span class="Constant">local-scope</span> <span id="L1798" class="LineNr">1798 </span> <span class="Constant">load-ingredients</span> <span id="L1799" class="LineNr">1799 </span> <span class="Comment"># compute range to delete</span> -<span id="L1800" class="LineNr">1800 </span> start:&:duplex-list:char <span class="Special"><-</span> get *editor, <span class="Constant">before-cursor:offset</span> -<span id="L1801" class="LineNr">1801 </span> end:&:duplex-list:char <span class="Special"><-</span> <a href='../065duplex_list.mu.html#L29'>next</a> start +<span id="L1800" class="LineNr">1800 </span> start:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> get *editor, <span class="Constant">before-cursor:offset</span> +<span id="L1801" class="LineNr">1801 </span> end:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> <a href='../065duplex_list.mu.html#L29'>next</a> start <span id="L1802" class="LineNr">1802 </span> <span class="Delimiter">{</span> <span id="L1803" class="LineNr">1803 </span> <span class="Conceal">¦</span> at-end-of-text?:bool <span class="Special"><-</span> equal end, <span class="Constant">0/null</span> <span id="L1804" class="LineNr">1804 </span> <span class="Conceal">¦</span> <span class="muControl">break-if</span> at-end-of-text? @@ -2033,11 +2033,11 @@ if ('onhashchange' in window) { <span id="L1971" class="LineNr">1971 </span> <span id="L1972" class="LineNr">1972 </span><span class="muRecipe">after</span> <span class="Constant"><scroll-down></span> [ <span id="L1973" class="LineNr">1973 </span> trace<span class="Constant"> 10</span>, <span class="Constant">[app]</span>, <span class="Constant">[scroll down]</span> -<span id="L1974" class="LineNr">1974 </span> top-of-screen:&:duplex-list:char <span class="Special"><-</span> get *editor, <span class="Constant">top-of-screen:offset</span> +<span id="L1974" class="LineNr">1974 </span> top-of-screen:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> get *editor, <span class="Constant">top-of-screen:offset</span> <span id="L1975" class="LineNr">1975 </span> left:num <span class="Special"><-</span> get *editor, <span class="Constant">left:offset</span> <span id="L1976" class="LineNr">1976 </span> right:num <span class="Special"><-</span> get *editor, <span class="Constant">right:offset</span> <span id="L1977" class="LineNr">1977 </span> max:num <span class="Special"><-</span> subtract right, left -<span id="L1978" class="LineNr">1978 </span> old-top:&:duplex-list:char <span class="Special"><-</span> copy top-of-screen +<span id="L1978" class="LineNr">1978 </span> old-top:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> copy top-of-screen <span id="L1979" class="LineNr">1979 </span> top-of-screen <span class="Special"><-</span> <a href='003-shortcuts.mu.html#L1988'>before-start-of-next-line</a> top-of-screen, max <span id="L1980" class="LineNr">1980 </span> *editor <span class="Special"><-</span> put *editor, <span class="Constant">top-of-screen:offset</span>, top-of-screen <span id="L1981" class="LineNr">1981 </span> no-movement?:bool <span class="Special"><-</span> equal old-top, top-of-screen @@ -2047,11 +2047,11 @@ if ('onhashchange' in window) { <span id="L1985" class="LineNr">1985 </span><span class="Comment"># takes a pointer into the doubly-linked list, scans ahead at most 'max'</span> <span id="L1986" class="LineNr">1986 </span><span class="Comment"># positions until the next newline</span> <span id="L1987" class="LineNr">1987 </span><span class="Comment"># beware: never return null pointer.</span> -<span id="L1988" class="LineNr">1988 </span><span class="muRecipe">def</span> <a href='003-shortcuts.mu.html#L1988'>before-start-of-next-line</a> original:&:duplex-list:char, max:num<span class="muRecipe"> -> </span>curr:&:duplex-list:char [ +<span id="L1988" class="LineNr">1988 </span><span class="muRecipe">def</span> <a href='003-shortcuts.mu.html#L1988'>before-start-of-next-line</a> original:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char, max:num<span class="muRecipe"> -> </span>curr:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char [ <span id="L1989" class="LineNr">1989 </span> <span class="Constant">local-scope</span> <span id="L1990" class="LineNr">1990 </span> <span class="Constant">load-ingredients</span> <span id="L1991" class="LineNr">1991 </span> count:num <span class="Special"><-</span> copy<span class="Constant"> 0</span> -<span id="L1992" class="LineNr">1992 </span> curr:&:duplex-list:char <span class="Special"><-</span> copy original +<span id="L1992" class="LineNr">1992 </span> curr:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> copy original <span id="L1993" class="LineNr">1993 </span> <span class="Comment"># skip the initial newline if it exists</span> <span id="L1994" class="LineNr">1994 </span> <span class="Delimiter">{</span> <span id="L1995" class="LineNr">1995 </span> <span class="Conceal">¦</span> c:char <span class="Special"><-</span> get *curr, <span class="Constant">value:offset</span> @@ -2415,8 +2415,8 @@ if ('onhashchange' in window) { <span id="L2353" class="LineNr">2353 </span> <span id="L2354" class="LineNr">2354 </span><span class="muRecipe">after</span> <span class="Constant"><scroll-up></span> [ <span id="L2355" class="LineNr">2355 </span> trace<span class="Constant"> 10</span>, <span class="Constant">[app]</span>, <span class="Constant">[scroll up]</span> -<span id="L2356" class="LineNr">2356 </span> top-of-screen:&:duplex-list:char <span class="Special"><-</span> get *editor, <span class="Constant">top-of-screen:offset</span> -<span id="L2357" class="LineNr">2357 </span> old-top:&:duplex-list:char <span class="Special"><-</span> copy top-of-screen +<span id="L2356" class="LineNr">2356 </span> top-of-screen:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> get *editor, <span class="Constant">top-of-screen:offset</span> +<span id="L2357" class="LineNr">2357 </span> old-top:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> copy top-of-screen <span id="L2358" class="LineNr">2358 </span> top-of-screen <span class="Special"><-</span> <a href='003-shortcuts.mu.html#L2367'>before-previous-line</a> top-of-screen, editor <span id="L2359" class="LineNr">2359 </span> *editor <span class="Special"><-</span> put *editor, <span class="Constant">top-of-screen:offset</span>, top-of-screen <span id="L2360" class="LineNr">2360 </span> no-movement?:bool <span class="Special"><-</span> equal old-top, top-of-screen @@ -2426,10 +2426,10 @@ if ('onhashchange' in window) { <span id="L2364" class="LineNr">2364 </span><span class="Comment"># takes a pointer into the doubly-linked list, scans back to before start of</span> <span id="L2365" class="LineNr">2365 </span><span class="Comment"># previous *wrapped* line</span> <span id="L2366" class="LineNr">2366 </span><span class="Comment"># beware: never return null pointer</span> -<span id="L2367" class="LineNr">2367 </span><span class="muRecipe">def</span> <a href='003-shortcuts.mu.html#L2367'>before-previous-line</a> in:&:duplex-list:char, editor:&:editor<span class="muRecipe"> -> </span>out:&:duplex-list:char [ +<span id="L2367" class="LineNr">2367 </span><span class="muRecipe">def</span> <a href='003-shortcuts.mu.html#L2367'>before-previous-line</a> in:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char, editor:&:editor<span class="muRecipe"> -> </span>out:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char [ <span id="L2368" class="LineNr">2368 </span> <span class="Constant">local-scope</span> <span id="L2369" class="LineNr">2369 </span> <span class="Constant">load-ingredients</span> -<span id="L2370" class="LineNr">2370 </span> curr:&:duplex-list:char <span class="Special"><-</span> copy in +<span id="L2370" class="LineNr">2370 </span> curr:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> copy in <span id="L2371" class="LineNr">2371 </span> c:char <span class="Special"><-</span> get *curr, <span class="Constant">value:offset</span> <span id="L2372" class="LineNr">2372 </span> <span class="Comment"># compute max, number of characters to skip</span> <span id="L2373" class="LineNr">2373 </span> <span class="Comment"># 1 + len%(width-1)</span> @@ -2437,12 +2437,12 @@ if ('onhashchange' in window) { <span id="L2375" class="LineNr">2375 </span> left:num <span class="Special"><-</span> get *editor, <span class="Constant">left:offset</span> <span id="L2376" class="LineNr">2376 </span> right:num <span class="Special"><-</span> get *editor, <span class="Constant">right:offset</span> <span id="L2377" class="LineNr">2377 </span> max-line-length:num <span class="Special"><-</span> subtract right, left, <span class="Constant">-1/exclusive-right</span>, <span class="Constant">1/wrap-icon</span> -<span id="L2378" class="LineNr">2378 </span> sentinel:&:duplex-list:char <span class="Special"><-</span> get *editor, <span class="Constant">data:offset</span> +<span id="L2378" class="LineNr">2378 </span> sentinel:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> get *editor, <span class="Constant">data:offset</span> <span id="L2379" class="LineNr">2379 </span> len:num <span class="Special"><-</span> <a href='003-shortcuts.mu.html#L193'>previous-line-length</a> curr, sentinel <span id="L2380" class="LineNr">2380 </span> <span class="Delimiter">{</span> <span id="L2381" class="LineNr">2381 </span> <span class="Conceal">¦</span> <span class="muControl">break-if</span> len <span id="L2382" class="LineNr">2382 </span> <span class="Conceal">¦</span> <span class="Comment"># empty line; just skip this newline</span> -<span id="L2383" class="LineNr">2383 </span> <span class="Conceal">¦</span> <a href='../065duplex_list.mu.html#L36'>prev</a>:&:duplex-list:char <span class="Special"><-</span> <a href='../065duplex_list.mu.html#L36'>prev</a> curr +<span id="L2383" class="LineNr">2383 </span> <span class="Conceal">¦</span> <a href='../065duplex_list.mu.html#L36'>prev</a>:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> <a href='../065duplex_list.mu.html#L36'>prev</a> curr <span id="L2384" class="LineNr">2384 </span> <span class="Conceal">¦</span> <span class="muControl">return-unless</span> <a href='../065duplex_list.mu.html#L36'>prev</a>, curr <span id="L2385" class="LineNr">2385 </span> <span class="Conceal">¦</span> <span class="muControl">return</span> <a href='../065duplex_list.mu.html#L36'>prev</a> <span id="L2386" class="LineNr">2386 </span> <span class="Delimiter">}</span> @@ -2458,7 +2458,7 @@ if ('onhashchange' in window) { <span id="L2396" class="LineNr">2396 </span> <span class="Delimiter">{</span> <span id="L2397" class="LineNr">2397 </span> <span class="Conceal">¦</span> done?:bool <span class="Special"><-</span> greater-or-equal count, max <span id="L2398" class="LineNr">2398 </span> <span class="Conceal">¦</span> <span class="muControl">break-if</span> done? -<span id="L2399" class="LineNr">2399 </span> <span class="Conceal">¦</span> <a href='../065duplex_list.mu.html#L36'>prev</a>:&:duplex-list:char <span class="Special"><-</span> <a href='../065duplex_list.mu.html#L36'>prev</a> curr +<span id="L2399" class="LineNr">2399 </span> <span class="Conceal">¦</span> <a href='../065duplex_list.mu.html#L36'>prev</a>:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> <a href='../065duplex_list.mu.html#L36'>prev</a> curr <span id="L2400" class="LineNr">2400 </span> <span class="Conceal">¦</span> <span class="muControl">break-unless</span> <a href='../065duplex_list.mu.html#L36'>prev</a> <span id="L2401" class="LineNr">2401 </span> <span class="Conceal">¦</span> curr <span class="Special"><-</span> copy <a href='../065duplex_list.mu.html#L36'>prev</a> <span id="L2402" class="LineNr">2402 </span> <span class="Conceal">¦</span> count <span class="Special"><-</span> add count,<span class="Constant"> 1</span> @@ -2820,12 +2820,12 @@ if ('onhashchange' in window) { <span id="L2758" class="LineNr">2758 </span> <span class="Delimiter">{</span> <span id="L2759" class="LineNr">2759 </span> <span class="Conceal">¦</span> page-down?:bool <span class="Special"><-</span> equal c, <span class="Constant">6/ctrl-f</span> <span id="L2760" class="LineNr">2760 </span> <span class="Conceal">¦</span> <span class="muControl">break-unless</span> page-down? -<span id="L2761" class="LineNr">2761 </span> <span class="Conceal">¦</span> old-top:&:duplex-list:char <span class="Special"><-</span> get *editor, <span class="Constant">top-of-screen:offset</span> +<span id="L2761" class="LineNr">2761 </span> <span class="Conceal">¦</span> old-top:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> get *editor, <span class="Constant">top-of-screen:offset</span> <span id="L2762" class="LineNr">2762 </span><span class="Constant"> </span><span class="Conceal">¦</span><span class="Constant"> <move-cursor-begin></span> <span id="L2763" class="LineNr">2763 </span> <span class="Conceal">¦</span> <a href='003-shortcuts.mu.html#L2789'>page-down</a> editor <span id="L2764" class="LineNr">2764 </span> <span class="Conceal">¦</span> undo-coalesce-tag:num <span class="Special"><-</span> copy <span class="Constant">0/never</span> <span id="L2765" class="LineNr">2765 </span><span class="Constant"> </span><span class="Conceal">¦</span><span class="Constant"> <move-cursor-end></span> -<span id="L2766" class="LineNr">2766 </span> <span class="Conceal">¦</span> top-of-screen:&:duplex-list:char <span class="Special"><-</span> get *editor, <span class="Constant">top-of-screen:offset</span> +<span id="L2766" class="LineNr">2766 </span> <span class="Conceal">¦</span> top-of-screen:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> get *editor, <span class="Constant">top-of-screen:offset</span> <span id="L2767" class="LineNr">2767 </span> <span class="Conceal">¦</span> movement?:bool <span class="Special"><-</span> not-equal top-of-screen, old-top <span id="L2768" class="LineNr">2768 </span> <span class="Conceal">¦</span> <span class="muControl">return</span> movement?/go-render <span id="L2769" class="LineNr">2769 </span> <span class="Delimiter">}</span> @@ -2835,12 +2835,12 @@ if ('onhashchange' in window) { <span id="L2773" class="LineNr">2773 </span> <span class="Delimiter">{</span> <span id="L2774" class="LineNr">2774 </span> <span class="Conceal">¦</span> page-down?:bool <span class="Special"><-</span> equal k, <span class="Constant">65518/page-down</span> <span id="L2775" class="LineNr">2775 </span> <span class="Conceal">¦</span> <span class="muControl">break-unless</span> page-down? -<span id="L2776" class="LineNr">2776 </span> <span class="Conceal">¦</span> old-top:&:duplex-list:char <span class="Special"><-</span> get *editor, <span class="Constant">top-of-screen:offset</span> +<span id="L2776" class="LineNr">2776 </span> <span class="Conceal">¦</span> old-top:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> get *editor, <span class="Constant">top-of-screen:offset</span> <span id="L2777" class="LineNr">2777 </span><span class="Constant"> </span><span class="Conceal">¦</span><span class="Constant"> <move-cursor-begin></span> <span id="L2778" class="LineNr">2778 </span> <span class="Conceal">¦</span> <a href='003-shortcuts.mu.html#L2789'>page-down</a> editor <span id="L2779" class="LineNr">2779 </span> <span class="Conceal">¦</span> undo-coalesce-tag:num <span class="Special"><-</span> copy <span class="Constant">0/never</span> <span id="L2780" class="LineNr">2780 </span><span class="Constant"> </span><span class="Conceal">¦</span><span class="Constant"> <move-cursor-end></span> -<span id="L2781" class="LineNr">2781 </span> <span class="Conceal">¦</span> top-of-screen:&:duplex-list:char <span class="Special"><-</span> get *editor, <span class="Constant">top-of-screen:offset</span> +<span id="L2781" class="LineNr">2781 </span> <span class="Conceal">¦</span> top-of-screen:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> get *editor, <span class="Constant">top-of-screen:offset</span> <span id="L2782" class="LineNr">2782 </span> <span class="Conceal">¦</span> movement?:bool <span class="Special"><-</span> not-equal top-of-screen, old-top <span id="L2783" class="LineNr">2783 </span> <span class="Conceal">¦</span> <span class="muControl">return</span> movement?/go-render <span id="L2784" class="LineNr">2784 </span> <span class="Delimiter">}</span> @@ -2852,11 +2852,11 @@ if ('onhashchange' in window) { <span id="L2790" class="LineNr">2790 </span> <span class="Constant">local-scope</span> <span id="L2791" class="LineNr">2791 </span> <span class="Constant">load-ingredients</span> <span id="L2792" class="LineNr">2792 </span> <span class="Comment"># if editor contents don't overflow screen, do nothing</span> -<span id="L2793" class="LineNr">2793 </span> bottom-of-screen:&:duplex-list:char <span class="Special"><-</span> get *editor, <span class="Constant">bottom-of-screen:offset</span> +<span id="L2793" class="LineNr">2793 </span> bottom-of-screen:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> get *editor, <span class="Constant">bottom-of-screen:offset</span> <span id="L2794" class="LineNr">2794 </span> <span class="muControl">return-unless</span> bottom-of-screen <span id="L2795" class="LineNr">2795 </span> <span class="Comment"># if not, position cursor at final character</span> -<span id="L2796" class="LineNr">2796 </span> before-cursor:&:duplex-list:char <span class="Special"><-</span> get *editor, <span class="Constant">before-cursor:offset</span> -<span id="L2797" class="LineNr">2797 </span> before-cursor:&:duplex-list:char <span class="Special"><-</span> <a href='../065duplex_list.mu.html#L36'>prev</a> bottom-of-screen +<span id="L2796" class="LineNr">2796 </span> before-cursor:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> get *editor, <span class="Constant">before-cursor:offset</span> +<span id="L2797" class="LineNr">2797 </span> before-cursor:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> <a href='../065duplex_list.mu.html#L36'>prev</a> bottom-of-screen <span id="L2798" class="LineNr">2798 </span> *editor <span class="Special"><-</span> put *editor, <span class="Constant">before-cursor:offset</span>, before-cursor <span id="L2799" class="LineNr">2799 </span> <span class="Comment"># keep one line in common with previous page</span> <span id="L2800" class="LineNr">2800 </span> <span class="Delimiter">{</span> @@ -3019,12 +3019,12 @@ if ('onhashchange' in window) { <span id="L2957" class="LineNr">2957 </span> <span class="Delimiter">{</span> <span id="L2958" class="LineNr">2958 </span> <span class="Conceal">¦</span> page-up?:bool <span class="Special"><-</span> equal c, <span class="Constant">2/ctrl-b</span> <span id="L2959" class="LineNr">2959 </span> <span class="Conceal">¦</span> <span class="muControl">break-unless</span> page-up? -<span id="L2960" class="LineNr">2960 </span> <span class="Conceal">¦</span> old-top:&:duplex-list:char <span class="Special"><-</span> get *editor, <span class="Constant">top-of-screen:offset</span> +<span id="L2960" class="LineNr">2960 </span> <span class="Conceal">¦</span> old-top:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> get *editor, <span class="Constant">top-of-screen:offset</span> <span id="L2961" class="LineNr">2961 </span><span class="Constant"> </span><span class="Conceal">¦</span><span class="Constant"> <move-cursor-begin></span> <span id="L2962" class="LineNr">2962 </span> <span class="Conceal">¦</span> editor <span class="Special"><-</span> <a href='003-shortcuts.mu.html#L2987'>page-up</a> editor, <a href='../081print.mu.html#L587'>screen-height</a> <span id="L2963" class="LineNr">2963 </span> <span class="Conceal">¦</span> undo-coalesce-tag:num <span class="Special"><-</span> copy <span class="Constant">0/never</span> <span id="L2964" class="LineNr">2964 </span><span class="Constant"> </span><span class="Conceal">¦</span><span class="Constant"> <move-cursor-end></span> -<span id="L2965" class="LineNr">2965 </span> <span class="Conceal">¦</span> top-of-screen:&:duplex-list:char <span class="Special"><-</span> get *editor, <span class="Constant">top-of-screen:offset</span> +<span id="L2965" class="LineNr">2965 </span> <span class="Conceal">¦</span> top-of-screen:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> get *editor, <span class="Constant">top-of-screen:offset</span> <span id="L2966" class="LineNr">2966 </span> <span class="Conceal">¦</span> movement?:bool <span class="Special"><-</span> not-equal top-of-screen, old-top <span id="L2967" class="LineNr">2967 </span> <span class="Conceal">¦</span> <span class="muControl">return</span> movement?/go-render <span id="L2968" class="LineNr">2968 </span> <span class="Delimiter">}</span> @@ -3034,12 +3034,12 @@ if ('onhashchange' in window) { <span id="L2972" class="LineNr">2972 </span> <span class="Delimiter">{</span> <span id="L2973" class="LineNr">2973 </span> <span class="Conceal">¦</span> page-up?:bool <span class="Special"><-</span> equal k, <span class="Constant">65519/page-up</span> <span id="L2974" class="LineNr">2974 </span> <span class="Conceal">¦</span> <span class="muControl">break-unless</span> page-up? -<span id="L2975" class="LineNr">2975 </span> <span class="Conceal">¦</span> old-top:&:duplex-list:char <span class="Special"><-</span> get *editor, <span class="Constant">top-of-screen:offset</span> +<span id="L2975" class="LineNr">2975 </span> <span class="Conceal">¦</span> old-top:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> get *editor, <span class="Constant">top-of-screen:offset</span> <span id="L2976" class="LineNr">2976 </span><span class="Constant"> </span><span class="Conceal">¦</span><span class="Constant"> <move-cursor-begin></span> <span id="L2977" class="LineNr">2977 </span> <span class="Conceal">¦</span> editor <span class="Special"><-</span> <a href='003-shortcuts.mu.html#L2987'>page-up</a> editor, <a href='../081print.mu.html#L587'>screen-height</a> <span id="L2978" class="LineNr">2978 </span> <span class="Conceal">¦</span> undo-coalesce-tag:num <span class="Special"><-</span> copy <span class="Constant">0/never</span> <span id="L2979" class="LineNr">2979 </span><span class="Constant"> </span><span class="Conceal">¦</span><span class="Constant"> <move-cursor-end></span> -<span id="L2980" class="LineNr">2980 </span> <span class="Conceal">¦</span> top-of-screen:&:duplex-list:char <span class="Special"><-</span> get *editor, <span class="Constant">top-of-screen:offset</span> +<span id="L2980" class="LineNr">2980 </span> <span class="Conceal">¦</span> top-of-screen:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> get *editor, <span class="Constant">top-of-screen:offset</span> <span id="L2981" class="LineNr">2981 </span> <span class="Conceal">¦</span> movement?:bool <span class="Special"><-</span> not-equal top-of-screen, old-top <span id="L2982" class="LineNr">2982 </span> <span class="Conceal">¦</span> <span class="Comment"># don't bother re-rendering if nothing changed. todo: test this</span> <span id="L2983" class="LineNr">2983 </span> <span class="Conceal">¦</span> <span class="muControl">return</span> movement?/go-render @@ -3051,11 +3051,11 @@ if ('onhashchange' in window) { <span id="L2989" class="LineNr">2989 </span> <span class="Constant">load-ingredients</span> <span id="L2990" class="LineNr">2990 </span> max:num <span class="Special"><-</span> subtract <a href='../081print.mu.html#L587'>screen-height</a>, <span class="Constant">1/menu-bar</span>, <span class="Constant">1/overlapping-line</span> <span id="L2991" class="LineNr">2991 </span> count:num <span class="Special"><-</span> copy<span class="Constant"> 0</span> -<span id="L2992" class="LineNr">2992 </span> top-of-screen:&:duplex-list:char <span class="Special"><-</span> get *editor, <span class="Constant">top-of-screen:offset</span> +<span id="L2992" class="LineNr">2992 </span> top-of-screen:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> get *editor, <span class="Constant">top-of-screen:offset</span> <span id="L2993" class="LineNr">2993 </span> <span class="Delimiter">{</span> <span id="L2994" class="LineNr">2994 </span> <span class="Conceal">¦</span> done?:bool <span class="Special"><-</span> greater-or-equal count, max <span id="L2995" class="LineNr">2995 </span> <span class="Conceal">¦</span> <span class="muControl">break-if</span> done? -<span id="L2996" class="LineNr">2996 </span> <span class="Conceal">¦</span> <a href='../065duplex_list.mu.html#L36'>prev</a>:&:duplex-list:char <span class="Special"><-</span> <a href='003-shortcuts.mu.html#L2367'>before-previous-line</a> top-of-screen, editor +<span id="L2996" class="LineNr">2996 </span> <span class="Conceal">¦</span> <a href='../065duplex_list.mu.html#L36'>prev</a>:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> <a href='003-shortcuts.mu.html#L2367'>before-previous-line</a> top-of-screen, editor <span id="L2997" class="LineNr">2997 </span> <span class="Conceal">¦</span> <span class="muControl">break-unless</span> <a href='../065duplex_list.mu.html#L36'>prev</a> <span id="L2998" class="LineNr">2998 </span> <span class="Conceal">¦</span> top-of-screen <span class="Special"><-</span> copy <a href='../065duplex_list.mu.html#L36'>prev</a> <span id="L2999" class="LineNr">2999 </span> <span class="Conceal">¦</span> *editor <span class="Special"><-</span> put *editor, <span class="Constant">top-of-screen:offset</span>, top-of-screen diff --git a/html/edit/004-programming-environment.mu.html b/html/edit/004-programming-environment.mu.html index 639825f9..2aeba796 100644 --- a/html/edit/004-programming-environment.mu.html +++ b/html/edit/004-programming-environment.mu.html @@ -257,19 +257,19 @@ if ('onhashchange' in window) { <span id="L194" class="LineNr">194 </span> left:num <span class="Special"><-</span> get *editor, <span class="Constant">left:offset</span> <span id="L195" class="LineNr">195 </span> <a href='../081print.mu.html#L587'>screen-height</a>:num <span class="Special"><-</span> <a href='../081print.mu.html#L587'>screen-height</a> <a href='../081print.mu.html#L4'>screen</a> <span id="L196" class="LineNr">196 </span> right:num <span class="Special"><-</span> get *editor, <span class="Constant">right:offset</span> -<span id="L197" class="LineNr">197 </span> curr:&:duplex-list:char <span class="Special"><-</span> get *editor, <span class="Constant">top-of-screen:offset</span> -<span id="L198" class="LineNr">198 </span> <a href='../065duplex_list.mu.html#L36'>prev</a>:&:duplex-list:char <span class="Special"><-</span> copy curr <span class="Comment"># just in case curr becomes null and we can't compute prev</span> +<span id="L197" class="LineNr">197 </span> curr:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> get *editor, <span class="Constant">top-of-screen:offset</span> +<span id="L198" class="LineNr">198 </span> <a href='../065duplex_list.mu.html#L36'>prev</a>:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> copy curr <span class="Comment"># just in case curr becomes null and we can't compute prev</span> <span id="L199" class="LineNr">199 </span> curr <span class="Special"><-</span> <a href='../065duplex_list.mu.html#L29'>next</a> curr <span id="L200" class="LineNr">200 </span> color:num <span class="Special"><-</span> copy <span class="Constant">7/white</span> <span id="L201" class="LineNr">201 </span> row:num <span class="Special"><-</span> copy <span class="Constant">1/top</span> <span id="L202" class="LineNr">202 </span> column:num <span class="Special"><-</span> copy left <span id="L203" class="LineNr">203 </span> <span class="Comment"># save before-cursor</span> -<span id="L204" class="LineNr">204 </span> old-before-cursor:&:duplex-list:char <span class="Special"><-</span> get *editor, <span class="Constant">before-cursor:offset</span> +<span id="L204" class="LineNr">204 </span> old-before-cursor:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> get *editor, <span class="Constant">before-cursor:offset</span> <span id="L205" class="LineNr">205 </span> <span class="Comment"># initialze cursor-row/cursor-column/before-cursor to the top of the screen</span> <span id="L206" class="LineNr">206 </span> <span class="Comment"># by default</span> <span id="L207" class="LineNr">207 </span> *editor <span class="Special"><-</span> put *editor, <span class="Constant">cursor-row:offset</span>, row <span id="L208" class="LineNr">208 </span> *editor <span class="Special"><-</span> put *editor, <span class="Constant">cursor-column:offset</span>, column -<span id="L209" class="LineNr">209 </span> top-of-screen:&:duplex-list:char <span class="Special"><-</span> get *editor, <span class="Constant">top-of-screen:offset</span> +<span id="L209" class="LineNr">209 </span> top-of-screen:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> get *editor, <span class="Constant">top-of-screen:offset</span> <span id="L210" class="LineNr">210 </span> *editor <span class="Special"><-</span> put *editor, <span class="Constant">before-cursor:offset</span>, top-of-screen <span id="L211" class="LineNr">211 </span> <a href='../081print.mu.html#L4'>screen</a> <span class="Special"><-</span> <a href='../081print.mu.html#L435'>move-cursor</a> <a href='../081print.mu.html#L4'>screen</a>, row, column <span id="L212" class="LineNr">212 </span> <span class="Delimiter">{</span> diff --git a/html/edit/005-sandbox.mu.html b/html/edit/005-sandbox.mu.html index 8346152a..9eb7d9f8 100644 --- a/html/edit/005-sandbox.mu.html +++ b/html/edit/005-sandbox.mu.html @@ -227,7 +227,7 @@ if ('onhashchange' in window) { <span id="L164" class="LineNr"> 164 </span> <span class="Conceal">¦</span> sandbox-count <span class="Special"><-</span> add sandbox-count,<span class="Constant"> 1</span> <span id="L165" class="LineNr"> 165 </span> <span class="Conceal">¦</span> *env <span class="Special"><-</span> put *env, <span class="Constant">number-of-sandboxes:offset</span>, sandbox-count <span id="L166" class="LineNr"> 166 </span> <span class="Conceal">¦</span> <span class="Comment"># clear sandbox editor</span> -<span id="L167" class="LineNr"> 167 </span> <span class="Conceal">¦</span> init:&:duplex-list:char <span class="Special"><-</span> push <span class="Constant">167/§</span>, <span class="Constant">0/tail</span> +<span id="L167" class="LineNr"> 167 </span> <span class="Conceal">¦</span> init:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> push <span class="Constant">167/§</span>, <span class="Constant">0/tail</span> <span id="L168" class="LineNr"> 168 </span> <span class="Conceal">¦</span> *current-sandbox <span class="Special"><-</span> put *current-sandbox, <span class="Constant">data:offset</span>, init <span id="L169" class="LineNr"> 169 </span> <span class="Conceal">¦</span> *current-sandbox <span class="Special"><-</span> put *current-sandbox, <span class="Constant">top-of-screen:offset</span>, init <span id="L170" class="LineNr"> 170 </span> <span class="Delimiter">}</span> @@ -759,8 +759,8 @@ if ('onhashchange' in window) { <span id="L696" class="LineNr"> 696 </span><span class="muRecipe">def</span> <a href='005-sandbox.mu.html#L696'>editor-contents</a> editor:&:editor<span class="muRecipe"> -> </span>result:text [ <span id="L697" class="LineNr"> 697 </span> <span class="Constant">local-scope</span> <span id="L698" class="LineNr"> 698 </span> <span class="Constant">load-ingredients</span> -<span id="L699" class="LineNr"> 699 </span> buf:&:buffer <span class="Special"><-</span> <a href='../061text.mu.html#L131'>new-buffer</a><span class="Constant"> 80</span> -<span id="L700" class="LineNr"> 700 </span> curr:&:duplex-list:char <span class="Special"><-</span> get *editor, <span class="Constant">data:offset</span> +<span id="L699" class="LineNr"> 699 </span> buf:&:<a href='../061text.mu.html#L126'>buffer</a> <span class="Special"><-</span> <a href='../061text.mu.html#L131'>new-buffer</a><span class="Constant"> 80</span> +<span id="L700" class="LineNr"> 700 </span> curr:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> get *editor, <span class="Constant">data:offset</span> <span id="L701" class="LineNr"> 701 </span> <span class="Comment"># skip § sentinel</span> <span id="L702" class="LineNr"> 702 </span> assert curr, <span class="Constant">[editor without data is illegal; must have at least a sentinel]</span> <span id="L703" class="LineNr"> 703 </span> curr <span class="Special"><-</span> <a href='../065duplex_list.mu.html#L29'>next</a> curr diff --git a/html/edit/006-sandbox-copy.mu.html b/html/edit/006-sandbox-copy.mu.html index 16b8d819..61a06072 100644 --- a/html/edit/006-sandbox-copy.mu.html +++ b/html/edit/006-sandbox-copy.mu.html @@ -263,8 +263,8 @@ if ('onhashchange' in window) { <span id="L201" class="LineNr">201 </span><span class="muRecipe">def</span> <a href='006-sandbox-copy.mu.html#L201'>empty-editor?</a> editor:&:editor<span class="muRecipe"> -> </span>result:bool [ <span id="L202" class="LineNr">202 </span> <span class="Constant">local-scope</span> <span id="L203" class="LineNr">203 </span> <span class="Constant">load-ingredients</span> -<span id="L204" class="LineNr">204 </span> head:&:duplex-list:char <span class="Special"><-</span> get *editor, <span class="Constant">data:offset</span> -<span id="L205" class="LineNr">205 </span> first:&:duplex-list:char <span class="Special"><-</span> <a href='../065duplex_list.mu.html#L29'>next</a> head +<span id="L204" class="LineNr">204 </span> head:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> get *editor, <span class="Constant">data:offset</span> +<span id="L205" class="LineNr">205 </span> first:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> <a href='../065duplex_list.mu.html#L29'>next</a> head <span id="L206" class="LineNr">206 </span> result <span class="Special"><-</span> not first <span id="L207" class="LineNr">207 </span>] <span id="L208" class="LineNr">208 </span> diff --git a/html/edit/011-errors.mu.html b/html/edit/011-errors.mu.html index a22244b0..8c2a1f1c 100644 --- a/html/edit/011-errors.mu.html +++ b/html/edit/011-errors.mu.html @@ -377,12 +377,12 @@ if ('onhashchange' in window) { <span id="L314" class="LineNr">314 </span> <span class="Comment"># overload a well-known shape-shifting recipe</span> <span id="L315" class="LineNr">315 </span> assume-resources [ <span id="L316" class="LineNr">316 </span> <span class="Conceal">¦</span> <span class="Constant">[lesson/recipes.mu]</span> <span class="Special"><-</span> [ -<span id="L317" class="LineNr">317 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Constant">|recipe</span> length l:&:list:_elem<span class="muRecipe"> -> </span>n:num <span class="Constant">[|</span> +<span id="L317" class="LineNr">317 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Constant">|recipe</span> length l:&:<a href='../064list.mu.html#L6'>list</a>:_elem<span class="muRecipe"> -> </span>n:num <span class="Constant">[|</span> <span id="L318" class="LineNr">318 </span><span class="Constant"> </span><span class="Conceal">¦</span><span class="Constant"> </span><span class="Conceal">¦</span><span class="Constant"> |]</span>| <span id="L319" class="LineNr">319 </span> <span class="Conceal">¦</span> ] <span id="L320" class="LineNr">320 </span> ] <span id="L321" class="LineNr">321 </span> <span class="Comment"># call code that uses other variants of it, but not it itself</span> -<span id="L322" class="LineNr">322 </span> test-sandbox:text <span class="Special"><-</span> new <span class="Constant">[x:&:list:num <- copy 0</span> +<span id="L322" class="LineNr">322 </span> test-sandbox:text <span class="Special"><-</span> new <span class="Constant">[x:&:<a href='../064list.mu.html#L6'>list</a>:num <- copy 0</span> <span id="L323" class="LineNr">323 </span><span class="Constant">to-text x]</span> <span id="L324" class="LineNr">324 </span> env:&:environment <span class="Special"><-</span> <a href='004-programming-environment.mu.html#L21'>new-programming-environment</a> <a href='../088file.mu.html#L11'>resources</a>, <a href='../081print.mu.html#L4'>screen</a>, test-sandbox <span id="L325" class="LineNr">325 </span> <span class="Comment"># run it once</span> diff --git a/html/edit/012-editor-undo.mu.html b/html/edit/012-editor-undo.mu.html index bf1b7c99..2c227c0f 100644 --- a/html/edit/012-editor-undo.mu.html +++ b/html/edit/012-editor-undo.mu.html @@ -74,13 +74,13 @@ if ('onhashchange' in window) { <span id="L11" class="LineNr"> 11 </span><span class="muData">container</span> <a href='012-editor-undo.mu.html#L11'>insert-operation</a> [ <span id="L12" class="LineNr"> 12 </span> before-row:num <span id="L13" class="LineNr"> 13 </span> before-column:num -<span id="L14" class="LineNr"> 14 </span> before-top-of-screen:&:duplex-list:char +<span id="L14" class="LineNr"> 14 </span> before-top-of-screen:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span id="L15" class="LineNr"> 15 </span> after-row:num <span id="L16" class="LineNr"> 16 </span> after-column:num -<span id="L17" class="LineNr"> 17 </span> after-top-of-screen:&:duplex-list:char +<span id="L17" class="LineNr"> 17 </span> after-top-of-screen:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span id="L18" class="LineNr"> 18 </span> <span class="Comment"># inserted text is from 'insert-from' until 'insert-until'; list doesn't have to terminate</span> -<span id="L19" class="LineNr"> 19 </span> insert-from:&:duplex-list:char -<span id="L20" class="LineNr"> 20 </span> insert-until:&:duplex-list:char +<span id="L19" class="LineNr"> 19 </span> insert-from:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char +<span id="L20" class="LineNr"> 20 </span> insert-until:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span id="L21" class="LineNr"> 21 </span> tag:num <span class="Comment"># event causing this operation; might be used to coalesce runs of similar events</span> <span id="L22" class="LineNr"> 22 </span> <span class="Conceal">¦</span> <span class="Comment"># 0: no coalesce (enter+indent)</span> <span id="L23" class="LineNr"> 23 </span> <span class="Conceal">¦</span> <span class="Comment"># 1: regular alphanumeric characters</span> @@ -89,10 +89,10 @@ if ('onhashchange' in window) { <span id="L26" class="LineNr"> 26 </span><span class="muData">container</span> <a href='012-editor-undo.mu.html#L26'>move-operation</a> [ <span id="L27" class="LineNr"> 27 </span> before-row:num <span id="L28" class="LineNr"> 28 </span> before-column:num -<span id="L29" class="LineNr"> 29 </span> before-top-of-screen:&:duplex-list:char +<span id="L29" class="LineNr"> 29 </span> before-top-of-screen:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span id="L30" class="LineNr"> 30 </span> after-row:num <span id="L31" class="LineNr"> 31 </span> after-column:num -<span id="L32" class="LineNr"> 32 </span> after-top-of-screen:&:duplex-list:char +<span id="L32" class="LineNr"> 32 </span> after-top-of-screen:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span id="L33" class="LineNr"> 33 </span> tag:num <span class="Comment"># event causing this operation; might be used to coalesce runs of similar events</span> <span id="L34" class="LineNr"> 34 </span> <span class="Conceal">¦</span> <span class="Comment"># 0: no coalesce (touch events, etc)</span> <span id="L35" class="LineNr"> 35 </span> <span class="Conceal">¦</span> <span class="Comment"># 1: left arrow</span> @@ -104,13 +104,13 @@ if ('onhashchange' in window) { <span id="L41" class="LineNr"> 41 </span><span class="muData">container</span> <a href='012-editor-undo.mu.html#L41'>delete-operation</a> [ <span id="L42" class="LineNr"> 42 </span> before-row:num <span id="L43" class="LineNr"> 43 </span> before-column:num -<span id="L44" class="LineNr"> 44 </span> before-top-of-screen:&:duplex-list:char +<span id="L44" class="LineNr"> 44 </span> before-top-of-screen:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span id="L45" class="LineNr"> 45 </span> after-row:num <span id="L46" class="LineNr"> 46 </span> after-column:num -<span id="L47" class="LineNr"> 47 </span> after-top-of-screen:&:duplex-list:char -<span id="L48" class="LineNr"> 48 </span> deleted-text:&:duplex-list:char -<span id="L49" class="LineNr"> 49 </span> delete-from:&:duplex-list:char -<span id="L50" class="LineNr"> 50 </span> delete-until:&:duplex-list:char +<span id="L47" class="LineNr"> 47 </span> after-top-of-screen:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char +<span id="L48" class="LineNr"> 48 </span> deleted-text:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char +<span id="L49" class="LineNr"> 49 </span> delete-from:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char +<span id="L50" class="LineNr"> 50 </span> delete-until:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span id="L51" class="LineNr"> 51 </span> tag:num <span class="Comment"># event causing this operation; might be used to coalesce runs of similar events</span> <span id="L52" class="LineNr"> 52 </span> <span class="Conceal">¦</span> <span class="Comment"># 0: no coalesce (ctrl-k, ctrl-u)</span> <span id="L53" class="LineNr"> 53 </span> <span class="Conceal">¦</span> <span class="Comment"># 1: backspace</span> @@ -119,8 +119,8 @@ if ('onhashchange' in window) { <span id="L56" class="LineNr"> 56 </span> <span id="L57" class="LineNr"> 57 </span><span class="Comment"># every editor accumulates a list of operations to undo/redo</span> <span id="L58" class="LineNr"> 58 </span><span class="muData">container</span> editor [ -<span id="L59" class="LineNr"> 59 </span> undo:&:list:&:<a href='012-editor-undo.mu.html#L5'>operation</a> -<span id="L60" class="LineNr"> 60 </span> redo:&:list:&:<a href='012-editor-undo.mu.html#L5'>operation</a> +<span id="L59" class="LineNr"> 59 </span> undo:&:<a href='../064list.mu.html#L6'>list</a>:&:<a href='012-editor-undo.mu.html#L5'>operation</a> +<span id="L60" class="LineNr"> 60 </span> redo:&:<a href='../064list.mu.html#L6'>list</a>:&:<a href='012-editor-undo.mu.html#L5'>operation</a> <span id="L61" class="LineNr"> 61 </span>] <span id="L62" class="LineNr"> 62 </span> <span id="L63" class="LineNr"> 63 </span><span class="Comment"># ctrl-z - undo operation</span> @@ -128,12 +128,12 @@ if ('onhashchange' in window) { <span id="L65" class="LineNr"> 65 </span> <span class="Delimiter">{</span> <span id="L66" class="LineNr"> 66 </span> <span class="Conceal">¦</span> undo?:bool <span class="Special"><-</span> equal c, <span class="Constant">26/ctrl-z</span> <span id="L67" class="LineNr"> 67 </span> <span class="Conceal">¦</span> <span class="muControl">break-unless</span> undo? -<span id="L68" class="LineNr"> 68 </span> <span class="Conceal">¦</span> undo:&:list:&:<a href='012-editor-undo.mu.html#L5'>operation</a> <span class="Special"><-</span> get *editor, <span class="Constant">undo:offset</span> +<span id="L68" class="LineNr"> 68 </span> <span class="Conceal">¦</span> undo:&:<a href='../064list.mu.html#L6'>list</a>:&:<a href='012-editor-undo.mu.html#L5'>operation</a> <span class="Special"><-</span> get *editor, <span class="Constant">undo:offset</span> <span id="L69" class="LineNr"> 69 </span> <span class="Conceal">¦</span> <span class="muControl">break-unless</span> undo <span id="L70" class="LineNr"> 70 </span> <span class="Conceal">¦</span> op:&:<a href='012-editor-undo.mu.html#L5'>operation</a> <span class="Special"><-</span> first undo <span id="L71" class="LineNr"> 71 </span> <span class="Conceal">¦</span> undo <span class="Special"><-</span> <a href='../064list.mu.html#L25'>rest</a> undo <span id="L72" class="LineNr"> 72 </span> <span class="Conceal">¦</span> *editor <span class="Special"><-</span> put *editor, <span class="Constant">undo:offset</span>, undo -<span id="L73" class="LineNr"> 73 </span> <span class="Conceal">¦</span> redo:&:list:&:<a href='012-editor-undo.mu.html#L5'>operation</a> <span class="Special"><-</span> get *editor, <span class="Constant">redo:offset</span> +<span id="L73" class="LineNr"> 73 </span> <span class="Conceal">¦</span> redo:&:<a href='../064list.mu.html#L6'>list</a>:&:<a href='012-editor-undo.mu.html#L5'>operation</a> <span class="Special"><-</span> get *editor, <span class="Constant">redo:offset</span> <span id="L74" class="LineNr"> 74 </span> <span class="Conceal">¦</span> redo <span class="Special"><-</span> push op, redo <span id="L75" class="LineNr"> 75 </span> <span class="Conceal">¦</span> *editor <span class="Special"><-</span> put *editor, <span class="Constant">redo:offset</span>, redo <span id="L76" class="LineNr"> 76 </span><span class="Constant"> </span><span class="Conceal">¦</span><span class="Constant"> <a href='012-editor-undo.mu.html#L76'><handle-undo></a></span> @@ -146,12 +146,12 @@ if ('onhashchange' in window) { <span id="L83" class="LineNr"> 83 </span> <span class="Delimiter">{</span> <span id="L84" class="LineNr"> 84 </span> <span class="Conceal">¦</span> redo?:bool <span class="Special"><-</span> equal c, <span class="Constant">25/ctrl-y</span> <span id="L85" class="LineNr"> 85 </span> <span class="Conceal">¦</span> <span class="muControl">break-unless</span> redo? -<span id="L86" class="LineNr"> 86 </span> <span class="Conceal">¦</span> redo:&:list:&:<a href='012-editor-undo.mu.html#L5'>operation</a> <span class="Special"><-</span> get *editor, <span class="Constant">redo:offset</span> +<span id="L86" class="LineNr"> 86 </span> <span class="Conceal">¦</span> redo:&:<a href='../064list.mu.html#L6'>list</a>:&:<a href='012-editor-undo.mu.html#L5'>operation</a> <span class="Special"><-</span> get *editor, <span class="Constant">redo:offset</span> <span id="L87" class="LineNr"> 87 </span> <span class="Conceal">¦</span> <span class="muControl">break-unless</span> redo <span id="L88" class="LineNr"> 88 </span> <span class="Conceal">¦</span> op:&:<a href='012-editor-undo.mu.html#L5'>operation</a> <span class="Special"><-</span> first redo <span id="L89" class="LineNr"> 89 </span> <span class="Conceal">¦</span> redo <span class="Special"><-</span> <a href='../064list.mu.html#L25'>rest</a> redo <span id="L90" class="LineNr"> 90 </span> <span class="Conceal">¦</span> *editor <span class="Special"><-</span> put *editor, <span class="Constant">redo:offset</span>, redo -<span id="L91" class="LineNr"> 91 </span> <span class="Conceal">¦</span> undo:&:list:&:<a href='012-editor-undo.mu.html#L5'>operation</a> <span class="Special"><-</span> get *editor, <span class="Constant">undo:offset</span> +<span id="L91" class="LineNr"> 91 </span> <span class="Conceal">¦</span> undo:&:<a href='../064list.mu.html#L6'>list</a>:&:<a href='012-editor-undo.mu.html#L5'>operation</a> <span class="Special"><-</span> get *editor, <span class="Constant">undo:offset</span> <span id="L92" class="LineNr"> 92 </span> <span class="Conceal">¦</span> undo <span class="Special"><-</span> push op, undo <span id="L93" class="LineNr"> 93 </span> <span class="Conceal">¦</span> *editor <span class="Special"><-</span> put *editor, <span class="Constant">undo:offset</span>, undo <span id="L94" class="LineNr"> 94 </span><span class="Constant"> </span><span class="Conceal">¦</span><span class="Constant"> <a href='012-editor-undo.mu.html#L94'><handle-redo></a></span> @@ -202,14 +202,14 @@ if ('onhashchange' in window) { <span id="L139" class="LineNr"> 139 </span> <span id="L140" class="LineNr"> 140 </span><span class="Comment"># save operation to undo</span> <span id="L141" class="LineNr"> 141 </span><span class="muRecipe">after</span> <span class="Constant"><insert-character-begin></span> [ -<span id="L142" class="LineNr"> 142 </span> top-before:&:duplex-list:char <span class="Special"><-</span> get *editor, <span class="Constant">top-of-screen:offset</span> -<span id="L143" class="LineNr"> 143 </span> cursor-before:&:duplex-list:char <span class="Special"><-</span> get *editor, <span class="Constant">before-cursor:offset</span> +<span id="L142" class="LineNr"> 142 </span> top-before:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> get *editor, <span class="Constant">top-of-screen:offset</span> +<span id="L143" class="LineNr"> 143 </span> cursor-before:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> get *editor, <span class="Constant">before-cursor:offset</span> <span id="L144" class="LineNr"> 144 </span>] <span id="L145" class="LineNr"> 145 </span><span class="muRecipe">before</span> <span class="Constant"><insert-character-end></span> [ -<span id="L146" class="LineNr"> 146 </span> top-after:&:duplex-list:char <span class="Special"><-</span> get *editor, <span class="Constant">top-of-screen:offset</span> +<span id="L146" class="LineNr"> 146 </span> top-after:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> get *editor, <span class="Constant">top-of-screen:offset</span> <span id="L147" class="LineNr"> 147 </span> cursor-row:num <span class="Special"><-</span> get *editor, <span class="Constant">cursor-row:offset</span> <span id="L148" class="LineNr"> 148 </span> cursor-column:num <span class="Special"><-</span> get *editor, <span class="Constant">cursor-column:offset</span> -<span id="L149" class="LineNr"> 149 </span> undo:&:list:&:<a href='012-editor-undo.mu.html#L5'>operation</a> <span class="Special"><-</span> get *editor, <span class="Constant">undo:offset</span> +<span id="L149" class="LineNr"> 149 </span> undo:&:<a href='../064list.mu.html#L6'>list</a>:&:<a href='012-editor-undo.mu.html#L5'>operation</a> <span class="Special"><-</span> get *editor, <span class="Constant">undo:offset</span> <span id="L150" class="LineNr"> 150 </span> <span class="Delimiter">{</span> <span id="L151" class="LineNr"> 151 </span> <span class="Conceal">¦</span> <span class="Comment"># if previous operation was an insert, coalesce this operation with it</span> <span id="L152" class="LineNr"> 152 </span> <span class="Conceal">¦</span> <span class="muControl">break-unless</span> undo @@ -218,8 +218,8 @@ if ('onhashchange' in window) { <span id="L155" class="LineNr"> 155 </span> <span class="Conceal">¦</span> <span class="muControl">break-unless</span> is-insert? <span id="L156" class="LineNr"> 156 </span> <span class="Conceal">¦</span> previous-coalesce-tag:num <span class="Special"><-</span> get typing, <span class="Constant">tag:offset</span> <span id="L157" class="LineNr"> 157 </span> <span class="Conceal">¦</span> <span class="muControl">break-unless</span> previous-coalesce-tag -<span id="L158" class="LineNr"> 158 </span> <span class="Conceal">¦</span> before-cursor:&:duplex-list:char <span class="Special"><-</span> get *editor, <span class="Constant">before-cursor:offset</span> -<span id="L159" class="LineNr"> 159 </span> <span class="Conceal">¦</span> insert-until:&:duplex-list:char <span class="Special"><-</span> <a href='../065duplex_list.mu.html#L29'>next</a> before-cursor +<span id="L158" class="LineNr"> 158 </span> <span class="Conceal">¦</span> before-cursor:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> get *editor, <span class="Constant">before-cursor:offset</span> +<span id="L159" class="LineNr"> 159 </span> <span class="Conceal">¦</span> insert-until:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> <a href='../065duplex_list.mu.html#L29'>next</a> before-cursor <span id="L160" class="LineNr"> 160 </span> <span class="Conceal">¦</span> typing <span class="Special"><-</span> put typing, <span class="Constant">insert-until:offset</span>, insert-until <span id="L161" class="LineNr"> 161 </span> <span class="Conceal">¦</span> typing <span class="Special"><-</span> put typing, <span class="Constant">after-row:offset</span>, cursor-row <span id="L162" class="LineNr"> 162 </span> <span class="Conceal">¦</span> typing <span class="Special"><-</span> put typing, <span class="Constant">after-column:offset</span>, cursor-column @@ -228,8 +228,8 @@ if ('onhashchange' in window) { <span id="L165" class="LineNr"> 165 </span> <span class="Conceal">¦</span> <span class="muControl">break</span> <span class="Constant">+done-adding-insert-operation</span> <span id="L166" class="LineNr"> 166 </span> <span class="Delimiter">}</span> <span id="L167" class="LineNr"> 167 </span> <span class="Comment"># if not, create a new operation</span> -<span id="L168" class="LineNr"> 168 </span> insert-from:&:duplex-list:char <span class="Special"><-</span> <a href='../065duplex_list.mu.html#L29'>next</a> cursor-before -<span id="L169" class="LineNr"> 169 </span> insert-to:&:duplex-list:char <span class="Special"><-</span> <a href='../065duplex_list.mu.html#L29'>next</a> insert-from +<span id="L168" class="LineNr"> 168 </span> insert-from:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> <a href='../065duplex_list.mu.html#L29'>next</a> cursor-before +<span id="L169" class="LineNr"> 169 </span> insert-to:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> <a href='../065duplex_list.mu.html#L29'>next</a> insert-from <span id="L170" class="LineNr"> 170 </span> op:&:<a href='012-editor-undo.mu.html#L5'>operation</a> <span class="Special"><-</span> new <span class="Constant"><a href='012-editor-undo.mu.html#L5'>operation</a>:type</span> <span id="L171" class="LineNr"> 171 </span> *op <span class="Special"><-</span> merge <span class="Constant">0/insert-operation</span>, save-row/before, save-column/before, top-before, cursor-row/after, cursor-column/after, top-after, insert-from, insert-to, <span class="Constant">1/coalesce</span> <span id="L172" class="LineNr"> 172 </span> editor <span class="Special"><-</span> <a href='012-editor-undo.mu.html#L200'>add-operation</a> editor, op @@ -240,17 +240,17 @@ if ('onhashchange' in window) { <span id="L177" class="LineNr"> 177 </span><span class="muRecipe">after</span> <span class="Constant"><a href='002-typing.mu.html#L857'><insert-enter-begin></a></span> [ <span id="L178" class="LineNr"> 178 </span> cursor-row-before:num <span class="Special"><-</span> copy cursor-row <span id="L179" class="LineNr"> 179 </span> cursor-column-before:num <span class="Special"><-</span> copy cursor-column -<span id="L180" class="LineNr"> 180 </span> top-before:&:duplex-list:char <span class="Special"><-</span> get *editor, <span class="Constant">top-of-screen:offset</span> -<span id="L181" class="LineNr"> 181 </span> cursor-before:&:duplex-list:char <span class="Special"><-</span> get *editor, <span class="Constant">before-cursor:offset</span> +<span id="L180" class="LineNr"> 180 </span> top-before:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> get *editor, <span class="Constant">top-of-screen:offset</span> +<span id="L181" class="LineNr"> 181 </span> cursor-before:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> get *editor, <span class="Constant">before-cursor:offset</span> <span id="L182" class="LineNr"> 182 </span>] <span id="L183" class="LineNr"> 183 </span><span class="muRecipe">before</span> <span class="Constant"><a href='002-typing.mu.html#L859'><insert-enter-end></a></span> [ -<span id="L184" class="LineNr"> 184 </span> top-after:&:duplex-list:char <span class="Special"><-</span> get *editor, <span class="Constant">top-of-screen:offset</span> +<span id="L184" class="LineNr"> 184 </span> top-after:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> get *editor, <span class="Constant">top-of-screen:offset</span> <span id="L185" class="LineNr"> 185 </span> cursor-row:num <span class="Special"><-</span> get *editor, <span class="Constant">cursor-row:offset</span> <span id="L186" class="LineNr"> 186 </span> cursor-column:num <span class="Special"><-</span> get *editor, <span class="Constant">cursor-row:offset</span> <span id="L187" class="LineNr"> 187 </span> <span class="Comment"># never coalesce</span> -<span id="L188" class="LineNr"> 188 </span> insert-from:&:duplex-list:char <span class="Special"><-</span> <a href='../065duplex_list.mu.html#L29'>next</a> cursor-before -<span id="L189" class="LineNr"> 189 </span> before-cursor:&:duplex-list:char <span class="Special"><-</span> get *editor, <span class="Constant">before-cursor:offset</span> -<span id="L190" class="LineNr"> 190 </span> insert-to:&:duplex-list:char <span class="Special"><-</span> <a href='../065duplex_list.mu.html#L29'>next</a> before-cursor +<span id="L188" class="LineNr"> 188 </span> insert-from:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> <a href='../065duplex_list.mu.html#L29'>next</a> cursor-before +<span id="L189" class="LineNr"> 189 </span> before-cursor:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> get *editor, <span class="Constant">before-cursor:offset</span> +<span id="L190" class="LineNr"> 190 </span> insert-to:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> <a href='../065duplex_list.mu.html#L29'>next</a> before-cursor <span id="L191" class="LineNr"> 191 </span> op:&:<a href='012-editor-undo.mu.html#L5'>operation</a> <span class="Special"><-</span> new <span class="Constant"><a href='012-editor-undo.mu.html#L5'>operation</a>:type</span> <span id="L192" class="LineNr"> 192 </span> *op <span class="Special"><-</span> merge <span class="Constant">0/insert-operation</span>, cursor-row-before, cursor-column-before, top-before, cursor-row/after, cursor-column/after, top-after, insert-from, insert-to, <span class="Constant">0/never-coalesce</span> <span id="L193" class="LineNr"> 193 </span> editor <span class="Special"><-</span> <a href='012-editor-undo.mu.html#L200'>add-operation</a> editor, op @@ -263,10 +263,10 @@ if ('onhashchange' in window) { <span id="L200" class="LineNr"> 200 </span><span class="muRecipe">def</span> <a href='012-editor-undo.mu.html#L200'>add-operation</a> editor:&:editor, op:&:<a href='012-editor-undo.mu.html#L5'>operation</a><span class="muRecipe"> -> </span>editor:&:editor [ <span id="L201" class="LineNr"> 201 </span> <span class="Constant">local-scope</span> <span id="L202" class="LineNr"> 202 </span> <span class="Constant">load-ingredients</span> -<span id="L203" class="LineNr"> 203 </span> undo:&:list:&:<a href='012-editor-undo.mu.html#L5'>operation</a> <span class="Special"><-</span> get *editor, <span class="Constant">undo:offset</span> +<span id="L203" class="LineNr"> 203 </span> undo:&:<a href='../064list.mu.html#L6'>list</a>:&:<a href='012-editor-undo.mu.html#L5'>operation</a> <span class="Special"><-</span> get *editor, <span class="Constant">undo:offset</span> <span id="L204" class="LineNr"> 204 </span> undo <span class="Special"><-</span> push op undo <span id="L205" class="LineNr"> 205 </span> *editor <span class="Special"><-</span> put *editor, <span class="Constant">undo:offset</span>, undo -<span id="L206" class="LineNr"> 206 </span> redo:&:list:&:<a href='012-editor-undo.mu.html#L5'>operation</a> <span class="Special"><-</span> get *editor, <span class="Constant">redo:offset</span> +<span id="L206" class="LineNr"> 206 </span> redo:&:<a href='../064list.mu.html#L6'>list</a>:&:<a href='012-editor-undo.mu.html#L5'>operation</a> <span class="Special"><-</span> get *editor, <span class="Constant">redo:offset</span> <span id="L207" class="LineNr"> 207 </span> redo <span class="Special"><-</span> copy<span class="Constant"> 0</span> <span id="L208" class="LineNr"> 208 </span> *editor <span class="Special"><-</span> put *editor, <span class="Constant">redo:offset</span>, redo <span id="L209" class="LineNr"> 209 </span>] @@ -275,17 +275,17 @@ if ('onhashchange' in window) { <span id="L212" class="LineNr"> 212 </span> <span class="Delimiter">{</span> <span id="L213" class="LineNr"> 213 </span> <span class="Conceal">¦</span> typing:<a href='012-editor-undo.mu.html#L11'>insert-operation</a>, is-insert?:bool <span class="Special"><-</span> maybe-convert *op, <span class="Constant">typing:variant</span> <span id="L214" class="LineNr"> 214 </span> <span class="Conceal">¦</span> <span class="muControl">break-unless</span> is-insert? -<span id="L215" class="LineNr"> 215 </span> <span class="Conceal">¦</span> start:&:duplex-list:char <span class="Special"><-</span> get typing, <span class="Constant">insert-from:offset</span> -<span id="L216" class="LineNr"> 216 </span> <span class="Conceal">¦</span> end:&:duplex-list:char <span class="Special"><-</span> get typing, <span class="Constant">insert-until:offset</span> +<span id="L215" class="LineNr"> 215 </span> <span class="Conceal">¦</span> start:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> get typing, <span class="Constant">insert-from:offset</span> +<span id="L216" class="LineNr"> 216 </span> <span class="Conceal">¦</span> end:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> get typing, <span class="Constant">insert-until:offset</span> <span id="L217" class="LineNr"> 217 </span> <span class="Conceal">¦</span> <span class="Comment"># assert cursor-row/cursor-column/top-of-screen match after-row/after-column/after-top-of-screen</span> -<span id="L218" class="LineNr"> 218 </span> <span class="Conceal">¦</span> before-cursor:&:duplex-list:char <span class="Special"><-</span> <a href='../065duplex_list.mu.html#L36'>prev</a> start +<span id="L218" class="LineNr"> 218 </span> <span class="Conceal">¦</span> before-cursor:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> <a href='../065duplex_list.mu.html#L36'>prev</a> start <span id="L219" class="LineNr"> 219 </span> <span class="Conceal">¦</span> *editor <span class="Special"><-</span> put *editor, <span class="Constant">before-cursor:offset</span>, before-cursor <span id="L220" class="LineNr"> 220 </span> <span class="Conceal">¦</span> <a href='../065duplex_list.mu.html#L357'>remove-between</a> before-cursor, end <span id="L221" class="LineNr"> 221 </span> <span class="Conceal">¦</span> cursor-row <span class="Special"><-</span> get typing, <span class="Constant">before-row:offset</span> <span id="L222" class="LineNr"> 222 </span> <span class="Conceal">¦</span> *editor <span class="Special"><-</span> put *editor, <span class="Constant">cursor-row:offset</span>, cursor-row <span id="L223" class="LineNr"> 223 </span> <span class="Conceal">¦</span> cursor-column <span class="Special"><-</span> get typing, <span class="Constant">before-column:offset</span> <span id="L224" class="LineNr"> 224 </span> <span class="Conceal">¦</span> *editor <span class="Special"><-</span> put *editor, <span class="Constant">cursor-column:offset</span>, cursor-column -<span id="L225" class="LineNr"> 225 </span> <span class="Conceal">¦</span> top:&:duplex-list:char <span class="Special"><-</span> get typing, <span class="Constant">before-top-of-screen:offset</span> +<span id="L225" class="LineNr"> 225 </span> <span class="Conceal">¦</span> top:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> get typing, <span class="Constant">before-top-of-screen:offset</span> <span id="L226" class="LineNr"> 226 </span> <span class="Conceal">¦</span> *editor <span class="Special"><-</span> put *editor, <span class="Constant">top-of-screen:offset</span>, top <span id="L227" class="LineNr"> 227 </span> <span class="Delimiter">}</span> <span id="L228" class="LineNr"> 228 </span>] @@ -476,7 +476,7 @@ if ('onhashchange' in window) { <span id="L413" class="LineNr"> 413 </span> <span class="Conceal">¦</span> typing:<a href='012-editor-undo.mu.html#L11'>insert-operation</a>, is-insert?:bool <span class="Special"><-</span> maybe-convert *op, <span class="Constant">typing:variant</span> <span id="L414" class="LineNr"> 414 </span> <span class="Conceal">¦</span> <span class="muControl">break-unless</span> is-insert? <span id="L415" class="LineNr"> 415 </span> <span class="Conceal">¦</span> before-cursor <span class="Special"><-</span> get *editor, <span class="Constant">before-cursor:offset</span> -<span id="L416" class="LineNr"> 416 </span> <span class="Conceal">¦</span> insert-from:&:duplex-list:char <span class="Special"><-</span> get typing, <span class="Constant">insert-from:offset</span> <span class="Comment"># ignore insert-to because it's already been spliced away</span> +<span id="L416" class="LineNr"> 416 </span> <span class="Conceal">¦</span> insert-from:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> get typing, <span class="Constant">insert-from:offset</span> <span class="Comment"># ignore insert-to because it's already been spliced away</span> <span id="L417" class="LineNr"> 417 </span> <span class="Conceal">¦</span> <span class="Comment"># assert insert-to matches next(before-cursor)</span> <span id="L418" class="LineNr"> 418 </span> <span class="Conceal">¦</span> <a href='../065duplex_list.mu.html#L497'>insert-range</a> before-cursor, insert-from <span id="L419" class="LineNr"> 419 </span> <span class="Conceal">¦</span> <span class="Comment"># assert cursor-row/cursor-column/top-of-screen match after-row/after-column/after-top-of-screen</span> @@ -484,7 +484,7 @@ if ('onhashchange' in window) { <span id="L421" class="LineNr"> 421 </span> <span class="Conceal">¦</span> *editor <span class="Special"><-</span> put *editor, <span class="Constant">cursor-row:offset</span>, cursor-row <span id="L422" class="LineNr"> 422 </span> <span class="Conceal">¦</span> cursor-column <span class="Special"><-</span> get typing, <span class="Constant">after-column:offset</span> <span id="L423" class="LineNr"> 423 </span> <span class="Conceal">¦</span> *editor <span class="Special"><-</span> put *editor, <span class="Constant">cursor-column:offset</span>, cursor-column -<span id="L424" class="LineNr"> 424 </span> <span class="Conceal">¦</span> top:&:duplex-list:char <span class="Special"><-</span> get typing, <span class="Constant">after-top-of-screen:offset</span> +<span id="L424" class="LineNr"> 424 </span> <span class="Conceal">¦</span> top:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> get typing, <span class="Constant">after-top-of-screen:offset</span> <span id="L425" class="LineNr"> 425 </span> <span class="Conceal">¦</span> *editor <span class="Special"><-</span> put *editor, <span class="Constant">top-of-screen:offset</span>, top <span id="L426" class="LineNr"> 426 </span> <span class="Delimiter">}</span> <span id="L427" class="LineNr"> 427 </span>] @@ -782,17 +782,17 @@ if ('onhashchange' in window) { <span id="L719" class="LineNr"> 719 </span><span class="muRecipe">after</span> <span class="Constant"><move-cursor-begin></span> [ <span id="L720" class="LineNr"> 720 </span> cursor-row-before:num <span class="Special"><-</span> get *editor, <span class="Constant">cursor-row:offset</span> <span id="L721" class="LineNr"> 721 </span> cursor-column-before:num <span class="Special"><-</span> get *editor, <span class="Constant">cursor-column:offset</span> -<span id="L722" class="LineNr"> 722 </span> top-before:&:duplex-list:char <span class="Special"><-</span> get *editor, <span class="Constant">top-of-screen:offset</span> +<span id="L722" class="LineNr"> 722 </span> top-before:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> get *editor, <span class="Constant">top-of-screen:offset</span> <span id="L723" class="LineNr"> 723 </span>] <span id="L724" class="LineNr"> 724 </span><span class="muRecipe">before</span> <span class="Constant"><move-cursor-end></span> [ -<span id="L725" class="LineNr"> 725 </span> top-after:&:duplex-list:char <span class="Special"><-</span> get *editor, <span class="Constant">top-of-screen:offset</span> +<span id="L725" class="LineNr"> 725 </span> top-after:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> get *editor, <span class="Constant">top-of-screen:offset</span> <span id="L726" class="LineNr"> 726 </span> cursor-row:num <span class="Special"><-</span> get *editor, <span class="Constant">cursor-row:offset</span> <span id="L727" class="LineNr"> 727 </span> cursor-column:num <span class="Special"><-</span> get *editor, <span class="Constant">cursor-column:offset</span> <span id="L728" class="LineNr"> 728 </span> <span class="Delimiter">{</span> <span id="L729" class="LineNr"> 729 </span> <span class="Conceal">¦</span> <span class="muControl">break-unless</span> undo-coalesce-tag <span id="L730" class="LineNr"> 730 </span> <span class="Conceal">¦</span> <span class="Comment"># if previous operation was also a move, and also had the same coalesce</span> <span id="L731" class="LineNr"> 731 </span> <span class="Conceal">¦</span> <span class="Comment"># tag, coalesce with it</span> -<span id="L732" class="LineNr"> 732 </span> <span class="Conceal">¦</span> undo:&:list:&:<a href='012-editor-undo.mu.html#L5'>operation</a> <span class="Special"><-</span> get *editor, <span class="Constant">undo:offset</span> +<span id="L732" class="LineNr"> 732 </span> <span class="Conceal">¦</span> undo:&:<a href='../064list.mu.html#L6'>list</a>:&:<a href='012-editor-undo.mu.html#L5'>operation</a> <span class="Special"><-</span> get *editor, <span class="Constant">undo:offset</span> <span id="L733" class="LineNr"> 733 </span> <span class="Conceal">¦</span> <span class="muControl">break-unless</span> undo <span id="L734" class="LineNr"> 734 </span> <span class="Conceal">¦</span> op:&:<a href='012-editor-undo.mu.html#L5'>operation</a> <span class="Special"><-</span> first undo <span id="L735" class="LineNr"> 735 </span> <span class="Conceal">¦</span> move:<a href='012-editor-undo.mu.html#L26'>move-operation</a>, is-move?:bool <span class="Special"><-</span> maybe-convert *op, <span class="Constant">move:variant</span> @@ -821,7 +821,7 @@ if ('onhashchange' in window) { <span id="L758" class="LineNr"> 758 </span> <span class="Conceal">¦</span> *editor <span class="Special"><-</span> put *editor, <span class="Constant">cursor-row:offset</span>, cursor-row <span id="L759" class="LineNr"> 759 </span> <span class="Conceal">¦</span> cursor-column <span class="Special"><-</span> get move, <span class="Constant">before-column:offset</span> <span id="L760" class="LineNr"> 760 </span> <span class="Conceal">¦</span> *editor <span class="Special"><-</span> put *editor, <span class="Constant">cursor-column:offset</span>, cursor-column -<span id="L761" class="LineNr"> 761 </span> <span class="Conceal">¦</span> top:&:duplex-list:char <span class="Special"><-</span> get move, <span class="Constant">before-top-of-screen:offset</span> +<span id="L761" class="LineNr"> 761 </span> <span class="Conceal">¦</span> top:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> get move, <span class="Constant">before-top-of-screen:offset</span> <span id="L762" class="LineNr"> 762 </span> <span class="Conceal">¦</span> *editor <span class="Special"><-</span> put *editor, <span class="Constant">top-of-screen:offset</span>, top <span id="L763" class="LineNr"> 763 </span> <span class="Delimiter">}</span> <span id="L764" class="LineNr"> 764 </span>] @@ -1457,7 +1457,7 @@ if ('onhashchange' in window) { <span id="L1394" class="LineNr">1394 </span> <span class="Conceal">¦</span> *editor <span class="Special"><-</span> put *editor, <span class="Constant">cursor-row:offset</span>, cursor-row <span id="L1395" class="LineNr">1395 </span> <span class="Conceal">¦</span> cursor-column <span class="Special"><-</span> get move, <span class="Constant">after-column:offset</span> <span id="L1396" class="LineNr">1396 </span> <span class="Conceal">¦</span> *editor <span class="Special"><-</span> put *editor, <span class="Constant">cursor-column:offset</span>, cursor-column -<span id="L1397" class="LineNr">1397 </span> <span class="Conceal">¦</span> top:&:duplex-list:char <span class="Special"><-</span> get move, <span class="Constant">after-top-of-screen:offset</span> +<span id="L1397" class="LineNr">1397 </span> <span class="Conceal">¦</span> top:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> get move, <span class="Constant">after-top-of-screen:offset</span> <span id="L1398" class="LineNr">1398 </span> <span class="Conceal">¦</span> *editor <span class="Special"><-</span> put *editor, <span class="Constant">top-of-screen:offset</span>, top <span id="L1399" class="LineNr">1399 </span> <span class="Delimiter">}</span> <span id="L1400" class="LineNr">1400 </span>] @@ -1678,16 +1678,16 @@ if ('onhashchange' in window) { <span id="L1615" class="LineNr">1615 </span> <span id="L1616" class="LineNr">1616 </span><span class="Comment"># save operation to undo</span> <span id="L1617" class="LineNr">1617 </span><span class="muRecipe">after</span> <span class="Constant"><a href='003-shortcuts.mu.html#L73'><backspace-character-begin></a></span> [ -<span id="L1618" class="LineNr">1618 </span> top-before:&:duplex-list:char <span class="Special"><-</span> get *editor, <span class="Constant">top-of-screen:offset</span> +<span id="L1618" class="LineNr">1618 </span> top-before:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> get *editor, <span class="Constant">top-of-screen:offset</span> <span id="L1619" class="LineNr">1619 </span>] <span id="L1620" class="LineNr">1620 </span><span class="muRecipe">before</span> <span class="Constant"><a href='003-shortcuts.mu.html#L75'><backspace-character-end></a></span> [ <span id="L1621" class="LineNr">1621 </span> <span class="Delimiter">{</span> <span id="L1622" class="LineNr">1622 </span> <span class="Conceal">¦</span> <span class="muControl">break-unless</span> backspaced-cell <span class="Comment"># backspace failed; don't add an undo operation</span> -<span id="L1623" class="LineNr">1623 </span> <span class="Conceal">¦</span> top-after:&:duplex-list:char <span class="Special"><-</span> get *editor, <span class="Constant">top-of-screen:offset</span> +<span id="L1623" class="LineNr">1623 </span> <span class="Conceal">¦</span> top-after:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> get *editor, <span class="Constant">top-of-screen:offset</span> <span id="L1624" class="LineNr">1624 </span> <span class="Conceal">¦</span> cursor-row:num <span class="Special"><-</span> get *editor, <span class="Constant">cursor-row:offset</span> <span id="L1625" class="LineNr">1625 </span> <span class="Conceal">¦</span> cursor-column:num <span class="Special"><-</span> get *editor, <span class="Constant">cursor-row:offset</span> -<span id="L1626" class="LineNr">1626 </span> <span class="Conceal">¦</span> before-cursor:&:duplex-list:char <span class="Special"><-</span> get *editor, <span class="Constant">before-cursor:offset</span> -<span id="L1627" class="LineNr">1627 </span> <span class="Conceal">¦</span> undo:&:list:&:<a href='012-editor-undo.mu.html#L5'>operation</a> <span class="Special"><-</span> get *editor, <span class="Constant">undo:offset</span> +<span id="L1626" class="LineNr">1626 </span> <span class="Conceal">¦</span> before-cursor:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> get *editor, <span class="Constant">before-cursor:offset</span> +<span id="L1627" class="LineNr">1627 </span> <span class="Conceal">¦</span> undo:&:<a href='../064list.mu.html#L6'>list</a>:&:<a href='012-editor-undo.mu.html#L5'>operation</a> <span class="Special"><-</span> get *editor, <span class="Constant">undo:offset</span> <span id="L1628" class="LineNr">1628 </span> <span class="Conceal">¦</span> <span class="Delimiter">{</span> <span id="L1629" class="LineNr">1629 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Comment"># if previous operation was an insert, coalesce this operation with it</span> <span id="L1630" class="LineNr">1630 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="muControl">break-unless</span> undo @@ -1698,7 +1698,7 @@ if ('onhashchange' in window) { <span id="L1635" class="LineNr">1635 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> coalesce?:bool <span class="Special"><-</span> equal previous-coalesce-tag, <span class="Constant">1/coalesce-backspace</span> <span id="L1636" class="LineNr">1636 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="muControl">break-unless</span> coalesce? <span id="L1637" class="LineNr">1637 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> deletion <span class="Special"><-</span> put deletion, <span class="Constant">delete-from:offset</span>, before-cursor -<span id="L1638" class="LineNr">1638 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> backspaced-so-far:&:duplex-list:char <span class="Special"><-</span> get deletion, <span class="Constant">deleted-text:offset</span> +<span id="L1638" class="LineNr">1638 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> backspaced-so-far:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> get deletion, <span class="Constant">deleted-text:offset</span> <span id="L1639" class="LineNr">1639 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <a href='../065duplex_list.mu.html#L497'>insert-range</a> backspaced-cell, backspaced-so-far <span id="L1640" class="LineNr">1640 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> deletion <span class="Special"><-</span> put deletion, <span class="Constant">deleted-text:offset</span>, backspaced-cell <span id="L1641" class="LineNr">1641 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> deletion <span class="Special"><-</span> put deletion, <span class="Constant">after-row:offset</span>, cursor-row @@ -1709,7 +1709,7 @@ if ('onhashchange' in window) { <span id="L1646" class="LineNr">1646 </span> <span class="Conceal">¦</span> <span class="Delimiter">}</span> <span id="L1647" class="LineNr">1647 </span> <span class="Conceal">¦</span> <span class="Comment"># if not, create a new operation</span> <span id="L1648" class="LineNr">1648 </span> <span class="Conceal">¦</span> op:&:<a href='012-editor-undo.mu.html#L5'>operation</a> <span class="Special"><-</span> new <span class="Constant"><a href='012-editor-undo.mu.html#L5'>operation</a>:type</span> -<span id="L1649" class="LineNr">1649 </span> <span class="Conceal">¦</span> deleted-until:&:duplex-list:char <span class="Special"><-</span> <a href='../065duplex_list.mu.html#L29'>next</a> before-cursor +<span id="L1649" class="LineNr">1649 </span> <span class="Conceal">¦</span> deleted-until:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> <a href='../065duplex_list.mu.html#L29'>next</a> before-cursor <span id="L1650" class="LineNr">1650 </span> <span class="Conceal">¦</span> *op <span class="Special"><-</span> merge <span class="Constant">2/delete-operation</span>, save-row/before, save-column/before, top-before, cursor-row/after, cursor-column/after, top-after, backspaced-cell/deleted, before-cursor/delete-from, deleted-until, <span class="Constant">1/coalesce-backspace</span> <span id="L1651" class="LineNr">1651 </span> <span class="Conceal">¦</span> editor <span class="Special"><-</span> <a href='012-editor-undo.mu.html#L200'>add-operation</a> editor, op <span id="L1652" class="LineNr">1652 </span><span class="Constant"> </span><span class="Conceal">¦</span><span class="Constant"> +done-adding-backspace-operation</span> @@ -1720,10 +1720,10 @@ if ('onhashchange' in window) { <span id="L1657" class="LineNr">1657 </span> <span class="Delimiter">{</span> <span id="L1658" class="LineNr">1658 </span> <span class="Conceal">¦</span> deletion:<a href='012-editor-undo.mu.html#L41'>delete-operation</a>, is-delete?:bool <span class="Special"><-</span> maybe-convert *op, <span class="Constant">delete:variant</span> <span id="L1659" class="LineNr">1659 </span> <span class="Conceal">¦</span> <span class="muControl">break-unless</span> is-delete? -<span id="L1660" class="LineNr">1660 </span> <span class="Conceal">¦</span> anchor:&:duplex-list:char <span class="Special"><-</span> get deletion, <span class="Constant">delete-from:offset</span> +<span id="L1660" class="LineNr">1660 </span> <span class="Conceal">¦</span> anchor:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> get deletion, <span class="Constant">delete-from:offset</span> <span id="L1661" class="LineNr">1661 </span> <span class="Conceal">¦</span> <span class="muControl">break-unless</span> anchor -<span id="L1662" class="LineNr">1662 </span> <span class="Conceal">¦</span> deleted:&:duplex-list:char <span class="Special"><-</span> get deletion, <span class="Constant">deleted-text:offset</span> -<span id="L1663" class="LineNr">1663 </span> <span class="Conceal">¦</span> old-cursor:&:duplex-list:char <span class="Special"><-</span> <a href='../065duplex_list.mu.html#L528'>last</a> deleted +<span id="L1662" class="LineNr">1662 </span> <span class="Conceal">¦</span> deleted:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> get deletion, <span class="Constant">deleted-text:offset</span> +<span id="L1663" class="LineNr">1663 </span> <span class="Conceal">¦</span> old-cursor:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> <a href='../065duplex_list.mu.html#L528'>last</a> deleted <span id="L1664" class="LineNr">1664 </span> <span class="Conceal">¦</span> <a href='../065duplex_list.mu.html#L497'>insert-range</a> anchor, deleted <span id="L1665" class="LineNr">1665 </span> <span class="Conceal">¦</span> <span class="Comment"># assert cursor-row/cursor-column/top-of-screen match after-row/after-column/after-top-of-screen</span> <span id="L1666" class="LineNr">1666 </span> <span class="Conceal">¦</span> before-cursor <span class="Special"><-</span> copy old-cursor @@ -1731,7 +1731,7 @@ if ('onhashchange' in window) { <span id="L1668" class="LineNr">1668 </span> <span class="Conceal">¦</span> *editor <span class="Special"><-</span> put *editor, <span class="Constant">cursor-row:offset</span>, cursor-row <span id="L1669" class="LineNr">1669 </span> <span class="Conceal">¦</span> cursor-column <span class="Special"><-</span> get deletion, <span class="Constant">before-column:offset</span> <span id="L1670" class="LineNr">1670 </span> <span class="Conceal">¦</span> *editor <span class="Special"><-</span> put *editor, <span class="Constant">cursor-column:offset</span>, cursor-column -<span id="L1671" class="LineNr">1671 </span> <span class="Conceal">¦</span> top:&:duplex-list:char <span class="Special"><-</span> get deletion, <span class="Constant">before-top-of-screen:offset</span> +<span id="L1671" class="LineNr">1671 </span> <span class="Conceal">¦</span> top:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> get deletion, <span class="Constant">before-top-of-screen:offset</span> <span id="L1672" class="LineNr">1672 </span> <span class="Conceal">¦</span> *editor <span class="Special"><-</span> put *editor, <span class="Constant">top-of-screen:offset</span>, top <span id="L1673" class="LineNr">1673 </span> <span class="Delimiter">}</span> <span id="L1674" class="LineNr">1674 </span>] @@ -1740,16 +1740,16 @@ if ('onhashchange' in window) { <span id="L1677" class="LineNr">1677 </span> <span class="Delimiter">{</span> <span id="L1678" class="LineNr">1678 </span> <span class="Conceal">¦</span> deletion:<a href='012-editor-undo.mu.html#L41'>delete-operation</a>, is-delete?:bool <span class="Special"><-</span> maybe-convert *op, <span class="Constant">delete:variant</span> <span id="L1679" class="LineNr">1679 </span> <span class="Conceal">¦</span> <span class="muControl">break-unless</span> is-delete? -<span id="L1680" class="LineNr">1680 </span> <span class="Conceal">¦</span> start:&:duplex-list:char <span class="Special"><-</span> get deletion, <span class="Constant">delete-from:offset</span> -<span id="L1681" class="LineNr">1681 </span> <span class="Conceal">¦</span> end:&:duplex-list:char <span class="Special"><-</span> get deletion, <span class="Constant">delete-until:offset</span> -<span id="L1682" class="LineNr">1682 </span> <span class="Conceal">¦</span> data:&:duplex-list:char <span class="Special"><-</span> get *editor, <span class="Constant">data:offset</span> +<span id="L1680" class="LineNr">1680 </span> <span class="Conceal">¦</span> start:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> get deletion, <span class="Constant">delete-from:offset</span> +<span id="L1681" class="LineNr">1681 </span> <span class="Conceal">¦</span> end:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> get deletion, <span class="Constant">delete-until:offset</span> +<span id="L1682" class="LineNr">1682 </span> <span class="Conceal">¦</span> data:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> get *editor, <span class="Constant">data:offset</span> <span id="L1683" class="LineNr">1683 </span> <span class="Conceal">¦</span> <a href='../065duplex_list.mu.html#L357'>remove-between</a> start, end <span id="L1684" class="LineNr">1684 </span> <span class="Conceal">¦</span> <span class="Comment"># assert cursor-row/cursor-column/top-of-screen match after-row/after-column/after-top-of-screen</span> <span id="L1685" class="LineNr">1685 </span> <span class="Conceal">¦</span> cursor-row <span class="Special"><-</span> get deletion, <span class="Constant">after-row:offset</span> <span id="L1686" class="LineNr">1686 </span> <span class="Conceal">¦</span> *editor <span class="Special"><-</span> put *editor, <span class="Constant">cursor-row:offset</span>, cursor-row <span id="L1687" class="LineNr">1687 </span> <span class="Conceal">¦</span> cursor-column <span class="Special"><-</span> get deletion, <span class="Constant">after-column:offset</span> <span id="L1688" class="LineNr">1688 </span> <span class="Conceal">¦</span> *editor <span class="Special"><-</span> put *editor, <span class="Constant">cursor-column:offset</span>, cursor-column -<span id="L1689" class="LineNr">1689 </span> <span class="Conceal">¦</span> top:&:duplex-list:char <span class="Special"><-</span> get deletion, <span class="Constant">before-top-of-screen:offset</span> +<span id="L1689" class="LineNr">1689 </span> <span class="Conceal">¦</span> top:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> get deletion, <span class="Constant">before-top-of-screen:offset</span> <span id="L1690" class="LineNr">1690 </span> <span class="Conceal">¦</span> *editor <span class="Special"><-</span> put *editor, <span class="Constant">top-of-screen:offset</span>, top <span id="L1691" class="LineNr">1691 </span> <span class="Delimiter">}</span> <span id="L1692" class="LineNr">1692 </span>] @@ -1904,16 +1904,16 @@ if ('onhashchange' in window) { <span id="L1841" class="LineNr">1841 </span>] <span id="L1842" class="LineNr">1842 </span> <span id="L1843" class="LineNr">1843 </span><span class="muRecipe">after</span> <span class="Constant"><a href='003-shortcuts.mu.html#L341'><delete-character-begin></a></span> [ -<span id="L1844" class="LineNr">1844 </span> top-before:&:duplex-list:char <span class="Special"><-</span> get *editor, <span class="Constant">top-of-screen:offset</span> +<span id="L1844" class="LineNr">1844 </span> top-before:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> get *editor, <span class="Constant">top-of-screen:offset</span> <span id="L1845" class="LineNr">1845 </span>] <span id="L1846" class="LineNr">1846 </span><span class="muRecipe">before</span> <span class="Constant"><a href='003-shortcuts.mu.html#L343'><delete-character-end></a></span> [ <span id="L1847" class="LineNr">1847 </span> <span class="Delimiter">{</span> <span id="L1848" class="LineNr">1848 </span> <span class="Conceal">¦</span> <span class="muControl">break-unless</span> deleted-cell <span class="Comment"># delete failed; don't add an undo operation</span> -<span id="L1849" class="LineNr">1849 </span> <span class="Conceal">¦</span> top-after:&:duplex-list:char <span class="Special"><-</span> get *editor, <span class="Constant">top-of-screen:offset</span> +<span id="L1849" class="LineNr">1849 </span> <span class="Conceal">¦</span> top-after:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> get *editor, <span class="Constant">top-of-screen:offset</span> <span id="L1850" class="LineNr">1850 </span> <span class="Conceal">¦</span> cursor-row:num <span class="Special"><-</span> get *editor, <span class="Constant">cursor-row:offset</span> <span id="L1851" class="LineNr">1851 </span> <span class="Conceal">¦</span> cursor-column:num <span class="Special"><-</span> get *editor, <span class="Constant">cursor-column:offset</span> -<span id="L1852" class="LineNr">1852 </span> <span class="Conceal">¦</span> before-cursor:&:duplex-list:char <span class="Special"><-</span> get *editor, <span class="Constant">before-cursor:offset</span> -<span id="L1853" class="LineNr">1853 </span> <span class="Conceal">¦</span> undo:&:list:&:<a href='012-editor-undo.mu.html#L5'>operation</a> <span class="Special"><-</span> get *editor, <span class="Constant">undo:offset</span> +<span id="L1852" class="LineNr">1852 </span> <span class="Conceal">¦</span> before-cursor:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> get *editor, <span class="Constant">before-cursor:offset</span> +<span id="L1853" class="LineNr">1853 </span> <span class="Conceal">¦</span> undo:&:<a href='../064list.mu.html#L6'>list</a>:&:<a href='012-editor-undo.mu.html#L5'>operation</a> <span class="Special"><-</span> get *editor, <span class="Constant">undo:offset</span> <span id="L1854" class="LineNr">1854 </span> <span class="Conceal">¦</span> <span class="Delimiter">{</span> <span id="L1855" class="LineNr">1855 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="Comment"># if previous operation was an insert, coalesce this operation with it</span> <span id="L1856" class="LineNr">1856 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="muControl">break-unless</span> undo @@ -1923,9 +1923,9 @@ if ('onhashchange' in window) { <span id="L1860" class="LineNr">1860 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> previous-coalesce-tag:num <span class="Special"><-</span> get deletion, <span class="Constant">tag:offset</span> <span id="L1861" class="LineNr">1861 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> coalesce?:bool <span class="Special"><-</span> equal previous-coalesce-tag, <span class="Constant">2/coalesce-delete</span> <span id="L1862" class="LineNr">1862 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="muControl">break-unless</span> coalesce? -<span id="L1863" class="LineNr">1863 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> delete-until:&:duplex-list:char <span class="Special"><-</span> <a href='../065duplex_list.mu.html#L29'>next</a> before-cursor +<span id="L1863" class="LineNr">1863 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> delete-until:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> <a href='../065duplex_list.mu.html#L29'>next</a> before-cursor <span id="L1864" class="LineNr">1864 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> deletion <span class="Special"><-</span> put deletion, <span class="Constant">delete-until:offset</span>, delete-until -<span id="L1865" class="LineNr">1865 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> deleted-so-far:&:duplex-list:char <span class="Special"><-</span> get deletion, <span class="Constant">deleted-text:offset</span> +<span id="L1865" class="LineNr">1865 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> deleted-so-far:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> get deletion, <span class="Constant">deleted-text:offset</span> <span id="L1866" class="LineNr">1866 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> deleted-so-far <span class="Special"><-</span> append deleted-so-far, deleted-cell <span id="L1867" class="LineNr">1867 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> deletion <span class="Special"><-</span> put deletion, <span class="Constant">deleted-text:offset</span>, deleted-so-far <span id="L1868" class="LineNr">1868 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> deletion <span class="Special"><-</span> put deletion, <span class="Constant">after-row:offset</span>, cursor-row @@ -1936,7 +1936,7 @@ if ('onhashchange' in window) { <span id="L1873" class="LineNr">1873 </span> <span class="Conceal">¦</span> <span class="Delimiter">}</span> <span id="L1874" class="LineNr">1874 </span> <span class="Conceal">¦</span> <span class="Comment"># if not, create a new operation</span> <span id="L1875" class="LineNr">1875 </span> <span class="Conceal">¦</span> op:&:<a href='012-editor-undo.mu.html#L5'>operation</a> <span class="Special"><-</span> new <span class="Constant"><a href='012-editor-undo.mu.html#L5'>operation</a>:type</span> -<span id="L1876" class="LineNr">1876 </span> <span class="Conceal">¦</span> deleted-until:&:duplex-list:char <span class="Special"><-</span> <a href='../065duplex_list.mu.html#L29'>next</a> before-cursor +<span id="L1876" class="LineNr">1876 </span> <span class="Conceal">¦</span> deleted-until:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> <a href='../065duplex_list.mu.html#L29'>next</a> before-cursor <span id="L1877" class="LineNr">1877 </span> <span class="Conceal">¦</span> *op <span class="Special"><-</span> merge <span class="Constant">2/delete-operation</span>, save-row/before, save-column/before, top-before, cursor-row/after, cursor-column/after, top-after, deleted-cell/deleted, before-cursor/delete-from, deleted-until, <span class="Constant">2/coalesce-delete</span> <span id="L1878" class="LineNr">1878 </span> <span class="Conceal">¦</span> editor <span class="Special"><-</span> <a href='012-editor-undo.mu.html#L200'>add-operation</a> editor, op <span id="L1879" class="LineNr">1879 </span><span class="Constant"> </span><span class="Conceal">¦</span><span class="Constant"> +done-adding-delete-operation</span> @@ -2030,15 +2030,15 @@ if ('onhashchange' in window) { <span id="L1967" class="LineNr">1967 </span>] <span id="L1968" class="LineNr">1968 </span> <span id="L1969" class="LineNr">1969 </span><span class="muRecipe">after</span> <span class="Constant"><a href='003-shortcuts.mu.html#L1789'><delete-to-end-of-line-begin></a></span> [ -<span id="L1970" class="LineNr">1970 </span> top-before:&:duplex-list:char <span class="Special"><-</span> get *editor, <span class="Constant">top-of-screen:offset</span> +<span id="L1970" class="LineNr">1970 </span> top-before:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> get *editor, <span class="Constant">top-of-screen:offset</span> <span id="L1971" class="LineNr">1971 </span>] <span id="L1972" class="LineNr">1972 </span><span class="muRecipe">before</span> <span class="Constant"><a href='003-shortcuts.mu.html#L1791'><delete-to-end-of-line-end></a></span> [ <span id="L1973" class="LineNr">1973 </span> <span class="Delimiter">{</span> <span id="L1974" class="LineNr">1974 </span> <span class="Conceal">¦</span> <span class="muControl">break-unless</span> deleted-cells <span class="Comment"># delete failed; don't add an undo operation</span> -<span id="L1975" class="LineNr">1975 </span> <span class="Conceal">¦</span> top-after:&:duplex-list:char <span class="Special"><-</span> get *editor, <span class="Constant">top-of-screen:offset</span> +<span id="L1975" class="LineNr">1975 </span> <span class="Conceal">¦</span> top-after:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> get *editor, <span class="Constant">top-of-screen:offset</span> <span id="L1976" class="LineNr">1976 </span> <span class="Conceal">¦</span> cursor-row:num <span class="Special"><-</span> get *editor, <span class="Constant">cursor-row:offset</span> <span id="L1977" class="LineNr">1977 </span> <span class="Conceal">¦</span> cursor-column:num <span class="Special"><-</span> get *editor, <span class="Constant">cursor-column:offset</span> -<span id="L1978" class="LineNr">1978 </span> <span class="Conceal">¦</span> deleted-until:&:duplex-list:char <span class="Special"><-</span> <a href='../065duplex_list.mu.html#L29'>next</a> before-cursor +<span id="L1978" class="LineNr">1978 </span> <span class="Conceal">¦</span> deleted-until:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> <a href='../065duplex_list.mu.html#L29'>next</a> before-cursor <span id="L1979" class="LineNr">1979 </span> <span class="Conceal">¦</span> op:&:<a href='012-editor-undo.mu.html#L5'>operation</a> <span class="Special"><-</span> new <span class="Constant"><a href='012-editor-undo.mu.html#L5'>operation</a>:type</span> <span id="L1980" class="LineNr">1980 </span> <span class="Conceal">¦</span> *op <span class="Special"><-</span> merge <span class="Constant">2/delete-operation</span>, save-row/before, save-column/before, top-before, cursor-row/after, cursor-column/after, top-after, deleted-cells/deleted, before-cursor/delete-from, deleted-until, <span class="Constant">0/never-coalesce</span> <span id="L1981" class="LineNr">1981 </span> <span class="Conceal">¦</span> editor <span class="Special"><-</span> <a href='012-editor-undo.mu.html#L200'>add-operation</a> editor, op @@ -2133,15 +2133,15 @@ if ('onhashchange' in window) { <span id="L2070" class="LineNr">2070 </span>] <span id="L2071" class="LineNr">2071 </span> <span id="L2072" class="LineNr">2072 </span><span class="muRecipe">after</span> <span class="Constant"><a href='003-shortcuts.mu.html#L1652'><delete-to-start-of-line-begin></a></span> [ -<span id="L2073" class="LineNr">2073 </span> top-before:&:duplex-list:char <span class="Special"><-</span> get *editor, <span class="Constant">top-of-screen:offset</span> +<span id="L2073" class="LineNr">2073 </span> top-before:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> get *editor, <span class="Constant">top-of-screen:offset</span> <span id="L2074" class="LineNr">2074 </span>] <span id="L2075" class="LineNr">2075 </span><span class="muRecipe">before</span> <span class="Constant"><a href='003-shortcuts.mu.html#L1654'><delete-to-start-of-line-end></a></span> [ <span id="L2076" class="LineNr">2076 </span> <span class="Delimiter">{</span> <span id="L2077" class="LineNr">2077 </span> <span class="Conceal">¦</span> <span class="muControl">break-unless</span> deleted-cells <span class="Comment"># delete failed; don't add an undo operation</span> -<span id="L2078" class="LineNr">2078 </span> <span class="Conceal">¦</span> top-after:&:duplex-list:char <span class="Special"><-</span> get *editor, <span class="Constant">top-of-screen:offset</span> +<span id="L2078" class="LineNr">2078 </span> <span class="Conceal">¦</span> top-after:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> get *editor, <span class="Constant">top-of-screen:offset</span> <span id="L2079" class="LineNr">2079 </span> <span class="Conceal">¦</span> op:&:<a href='012-editor-undo.mu.html#L5'>operation</a> <span class="Special"><-</span> new <span class="Constant"><a href='012-editor-undo.mu.html#L5'>operation</a>:type</span> -<span id="L2080" class="LineNr">2080 </span> <span class="Conceal">¦</span> before-cursor:&:duplex-list:char <span class="Special"><-</span> get *editor, <span class="Constant">before-cursor:offset</span> -<span id="L2081" class="LineNr">2081 </span> <span class="Conceal">¦</span> deleted-until:&:duplex-list:char <span class="Special"><-</span> <a href='../065duplex_list.mu.html#L29'>next</a> before-cursor +<span id="L2080" class="LineNr">2080 </span> <span class="Conceal">¦</span> before-cursor:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> get *editor, <span class="Constant">before-cursor:offset</span> +<span id="L2081" class="LineNr">2081 </span> <span class="Conceal">¦</span> deleted-until:&:<a href='../065duplex_list.mu.html#L3'>duplex-list</a>:char <span class="Special"><-</span> <a href='../065duplex_list.mu.html#L29'>next</a> before-cursor <span id="L2082" class="LineNr">2082 </span> <span class="Conceal">¦</span> cursor-row:num <span class="Special"><-</span> get *editor, <span class="Constant">cursor-row:offset</span> <span id="L2083" class="LineNr">2083 </span> <span class="Conceal">¦</span> cursor-column:num <span class="Special"><-</span> get *editor, <span class="Constant">cursor-column:offset</span> <span id="L2084" class="LineNr">2084 </span> <span class="Conceal">¦</span> *op <span class="Special"><-</span> merge <span class="Constant">2/delete-operation</span>, save-row/before, save-column/before, top-before, cursor-row/after, cursor-column/after, top-after, deleted-cells/deleted, before-cursor/delete-from, deleted-until, <span class="Constant">0/never-coalesce</span> diff --git a/html/filesystem.mu.html b/html/filesystem.mu.html index 64776808..40703554 100644 --- a/html/filesystem.mu.html +++ b/html/filesystem.mu.html @@ -65,8 +65,8 @@ if ('onhashchange' in window) { <span id="L5" class="LineNr"> 5 </span> <span id="L6" class="LineNr"> 6 </span><span class="muRecipe">def</span> <a href='filesystem.mu.html#L6'>main</a> [ <span id="L7" class="LineNr"> 7 </span> <span class="Constant">local-scope</span> -<span id="L8" class="LineNr"> 8 </span> source-file:&:source:char <span class="Special"><-</span> <a href='088file.mu.html#L21'>start-reading</a> <span class="Constant">0/real-filesystem</span>, <span class="Constant">[/tmp/mu-x]</span> -<span id="L9" class="LineNr"> 9 </span> sink-file:&:sink:char, write-routine:num <span class="Special"><-</span> <a href='088file.mu.html#L105'>start-writing</a> <span class="Constant">0/real-filesystem</span>, <span class="Constant">[/tmp/mu-y]</span> +<span id="L8" class="LineNr"> 8 </span> source-file:&:<a href='075channel.mu.html#L43'>source</a>:char <span class="Special"><-</span> <a href='088file.mu.html#L21'>start-reading</a> <span class="Constant">0/real-filesystem</span>, <span class="Constant">[/tmp/mu-x]</span> +<span id="L9" class="LineNr"> 9 </span> sink-file:&:<a href='075channel.mu.html#L47'>sink</a>:char, write-routine:num <span class="Special"><-</span> <a href='088file.mu.html#L105'>start-writing</a> <span class="Constant">0/real-filesystem</span>, <span class="Constant">[/tmp/mu-y]</span> <span id="L10" class="LineNr">10 </span> <span class="Delimiter">{</span> <span id="L11" class="LineNr">11 </span> <span class="Conceal">¦</span> c:char, done?:bool, source-file <span class="Special"><-</span> read source-file <span id="L12" class="LineNr">12 </span> <span class="Conceal">¦</span> <span class="muControl">break-if</span> done? diff --git a/html/http-client.mu.html b/html/http-client.mu.html index 90b72559..17cb6fde 100644 --- a/html/http-client.mu.html +++ b/html/http-client.mu.html @@ -62,9 +62,9 @@ if ('onhashchange' in window) { <span id="L2" class="LineNr"> 2 </span> <span id="L3" class="LineNr"> 3 </span><span class="muRecipe">def</span> <a href='http-client.mu.html#L3'>main</a> [ <span id="L4" class="LineNr"> 4 </span> <span class="Constant">local-scope</span> -<span id="L5" class="LineNr"> 5 </span> google:&:source:char <span class="Special"><-</span> <a href='092socket.mu.html#L69'>start-reading-from-network</a> <span class="Constant">0/real-resources</span>, <span class="Constant">[google.com/]</span> +<span id="L5" class="LineNr"> 5 </span> google:&:<a href='075channel.mu.html#L43'>source</a>:char <span class="Special"><-</span> <a href='092socket.mu.html#L69'>start-reading-from-network</a> <span class="Constant">0/real-resources</span>, <span class="Constant">[google.com/]</span> <span id="L6" class="LineNr"> 6 </span> n:num <span class="Special"><-</span> copy<span class="Constant"> 0</span> -<span id="L7" class="LineNr"> 7 </span> buf:&:buffer <span class="Special"><-</span> <a href='061text.mu.html#L131'>new-buffer</a><span class="Constant"> 30</span> +<span id="L7" class="LineNr"> 7 </span> buf:&:<a href='061text.mu.html#L126'>buffer</a> <span class="Special"><-</span> <a href='061text.mu.html#L131'>new-buffer</a><span class="Constant"> 30</span> <span id="L8" class="LineNr"> 8 </span> <span class="Delimiter">{</span> <span id="L9" class="LineNr"> 9 </span> <span class="Conceal">¦</span> c:char, done?:bool <span class="Special"><-</span> read google <span id="L10" class="LineNr">10 </span> <span class="Conceal">¦</span> <span class="muControl">break-if</span> done? diff --git a/html/http-server.mu.html b/html/http-server.mu.html index f1e97cc7..21ee77c7 100644 --- a/html/http-server.mu.html +++ b/html/http-server.mu.html @@ -71,8 +71,8 @@ if ('onhashchange' in window) { <span id="L13" class="LineNr">13 </span> $print <span class="Constant">[Mu socket creation returned ]</span>, socket, <span class="Constant">10/newline</span> <span id="L14" class="LineNr">14 </span> <span class="muControl">return-unless</span> socket <span id="L15" class="LineNr">15 </span> session:num <span class="Special"><-</span> $accept socket -<span id="L16" class="LineNr">16 </span> contents:&:source:char, sink:&:sink:char <span class="Special"><-</span> <a href='075channel.mu.html#L51'>new-channel</a><span class="Constant"> 30</span> -<span id="L17" class="LineNr">17 </span> sink <span class="Special"><-</span> start-running <a href='092socket.mu.html#L104'>receive-from-socket</a> session, sink +<span id="L16" class="LineNr">16 </span> contents:&:<a href='075channel.mu.html#L43'>source</a>:char, <a href='075channel.mu.html#L47'>sink</a>:&:<a href='075channel.mu.html#L47'>sink</a>:char <span class="Special"><-</span> <a href='075channel.mu.html#L51'>new-channel</a><span class="Constant"> 30</span> +<span id="L17" class="LineNr">17 </span> <a href='075channel.mu.html#L47'>sink</a> <span class="Special"><-</span> start-running <a href='092socket.mu.html#L104'>receive-from-socket</a> session, <a href='075channel.mu.html#L47'>sink</a> <span id="L18" class="LineNr">18 </span> query:text <span class="Special"><-</span> <a href='075channel.mu.html#L487'>drain</a> contents <span id="L19" class="LineNr">19 </span> $print <span class="Constant">[Done reading from socket.]</span>, <span class="Constant">10/newline</span> <span id="L20" class="LineNr">20 </span> <a href='092socket.mu.html#L132'>write-to-socket</a> session, <span class="Constant">[HTTP/1.0 200 OK</span> diff --git a/html/lambda-to-mu.mu.html b/html/lambda-to-mu.mu.html index 3a15158f..978ba9fb 100644 --- a/html/lambda-to-mu.mu.html +++ b/html/lambda-to-mu.mu.html @@ -240,12 +240,12 @@ if ('onhashchange' in window) { <span id="L176" class="LineNr">176 </span><span class="muRecipe">def</span> parse in:text<span class="muRecipe"> -> </span>out:&:<a href='lambda-to-mu.mu.html#L31'>cell</a> [ <span id="L177" class="LineNr">177 </span> <span class="Constant">local-scope</span> <span id="L178" class="LineNr">178 </span> <span class="Constant">load-ingredients</span> -<span id="L179" class="LineNr">179 </span> s:&:stream:char <span class="Special"><-</span> <a href='066stream.mu.html#L7'>new-stream</a> in +<span id="L179" class="LineNr">179 </span> s:&:<a href='066stream.mu.html#L2'>stream</a>:char <span class="Special"><-</span> <a href='066stream.mu.html#L7'>new-stream</a> in <span id="L180" class="LineNr">180 </span> out, s <span class="Special"><-</span> parse s <span id="L181" class="LineNr">181 </span> trace<span class="Constant"> 2</span>, <span class="Constant">[app/parse]</span>, out <span id="L182" class="LineNr">182 </span>] <span id="L183" class="LineNr">183 </span> -<span id="L184" class="LineNr">184 </span><span class="muRecipe">def</span> parse in:&:stream:char<span class="muRecipe"> -> </span>out:&:<a href='lambda-to-mu.mu.html#L31'>cell</a>, in:&:stream:char [ +<span id="L184" class="LineNr">184 </span><span class="muRecipe">def</span> parse in:&:<a href='066stream.mu.html#L2'>stream</a>:char<span class="muRecipe"> -> </span>out:&:<a href='lambda-to-mu.mu.html#L31'>cell</a>, in:&:<a href='066stream.mu.html#L2'>stream</a>:char [ <span id="L185" class="LineNr">185 </span> <span class="Constant">local-scope</span> <span id="L186" class="LineNr">186 </span> <span class="Constant">load-ingredients</span> <span id="L187" class="LineNr">187 </span> <span class="Comment"># skip whitespace</span> @@ -256,7 +256,7 @@ if ('onhashchange' in window) { <span id="L192" class="LineNr">192 </span> <span class="Delimiter">{</span> <span id="L193" class="LineNr">193 </span> <span class="Conceal">¦</span> <span class="muControl">break-if</span> pair? <span id="L194" class="LineNr">194 </span> <span class="Conceal">¦</span> <span class="Comment"># atom</span> -<span id="L195" class="LineNr">195 </span> <span class="Conceal">¦</span> buf:&:buffer <span class="Special"><-</span> <a href='061text.mu.html#L131'>new-buffer</a><span class="Constant"> 30</span> +<span id="L195" class="LineNr">195 </span> <span class="Conceal">¦</span> buf:&:<a href='061text.mu.html#L126'>buffer</a> <span class="Special"><-</span> <a href='061text.mu.html#L131'>new-buffer</a><span class="Constant"> 30</span> <span id="L196" class="LineNr">196 </span> <span class="Conceal">¦</span> <span class="Delimiter">{</span> <span id="L197" class="LineNr">197 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> done?:bool <span class="Special"><-</span> <a href='066stream.mu.html#L72'>end-of-stream?</a> in <span id="L198" class="LineNr">198 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="muControl">break-if</span> done? @@ -335,7 +335,7 @@ if ('onhashchange' in window) { <span id="L271" class="LineNr">271 </span> <span class="Delimiter">}</span> <span id="L272" class="LineNr">272 </span>] <span id="L273" class="LineNr">273 </span> -<span id="L274" class="LineNr">274 </span><span class="muRecipe">def</span> <a href='lambda-to-mu.mu.html#L274'>skip-whitespace</a> in:&:stream:char<span class="muRecipe"> -> </span>in:&:stream:char [ +<span id="L274" class="LineNr">274 </span><span class="muRecipe">def</span> <a href='lambda-to-mu.mu.html#L274'>skip-whitespace</a> in:&:<a href='066stream.mu.html#L2'>stream</a>:char<span class="muRecipe"> -> </span>in:&:<a href='066stream.mu.html#L2'>stream</a>:char [ <span id="L275" class="LineNr">275 </span> <span class="Constant">local-scope</span> <span id="L276" class="LineNr">276 </span> <span class="Constant">load-ingredients</span> <span id="L277" class="LineNr">277 </span> <span class="Delimiter">{</span> @@ -352,12 +352,12 @@ if ('onhashchange' in window) { <span id="L288" class="LineNr">288 </span><span class="muRecipe">def</span> to-text x:&:<a href='lambda-to-mu.mu.html#L31'>cell</a><span class="muRecipe"> -> </span>out:text [ <span id="L289" class="LineNr">289 </span> <span class="Constant">local-scope</span> <span id="L290" class="LineNr">290 </span> <span class="Constant">load-ingredients</span> -<span id="L291" class="LineNr">291 </span> buf:&:buffer <span class="Special"><-</span> <a href='061text.mu.html#L131'>new-buffer</a><span class="Constant"> 30</span> +<span id="L291" class="LineNr">291 </span> buf:&:<a href='061text.mu.html#L126'>buffer</a> <span class="Special"><-</span> <a href='061text.mu.html#L131'>new-buffer</a><span class="Constant"> 30</span> <span id="L292" class="LineNr">292 </span> buf <span class="Special"><-</span> to-buffer x, buf <span id="L293" class="LineNr">293 </span> out <span class="Special"><-</span> <a href='061text.mu.html#L328'>buffer-to-array</a> buf <span id="L294" class="LineNr">294 </span>] <span id="L295" class="LineNr">295 </span> -<span id="L296" class="LineNr">296 </span><span class="muRecipe">def</span> to-buffer x:&:<a href='lambda-to-mu.mu.html#L31'>cell</a>, buf:&:buffer<span class="muRecipe"> -> </span>buf:&:buffer [ +<span id="L296" class="LineNr">296 </span><span class="muRecipe">def</span> to-buffer x:&:<a href='lambda-to-mu.mu.html#L31'>cell</a>, buf:&:<a href='061text.mu.html#L126'>buffer</a><span class="muRecipe"> -> </span>buf:&:<a href='061text.mu.html#L126'>buffer</a> [ <span id="L297" class="LineNr">297 </span> <span class="Constant">local-scope</span> <span id="L298" class="LineNr">298 </span> <span class="Constant">load-ingredients</span> <span id="L299" class="LineNr">299 </span> <span class="Comment"># base case: empty cell</span> @@ -639,12 +639,12 @@ if ('onhashchange' in window) { <span id="L575" class="LineNr">575 </span><span class="muRecipe">def</span> to-mu in:&:<a href='lambda-to-mu.mu.html#L31'>cell</a><span class="muRecipe"> -> </span>out:text [ <span id="L576" class="LineNr">576 </span> <span class="Constant">local-scope</span> <span id="L577" class="LineNr">577 </span> <span class="Constant">load-ingredients</span> -<span id="L578" class="LineNr">578 </span> buf:&:buffer <span class="Special"><-</span> <a href='061text.mu.html#L131'>new-buffer</a><span class="Constant"> 30</span> +<span id="L578" class="LineNr">578 </span> buf:&:<a href='061text.mu.html#L126'>buffer</a> <span class="Special"><-</span> <a href='061text.mu.html#L131'>new-buffer</a><span class="Constant"> 30</span> <span id="L579" class="LineNr">579 </span> buf <span class="Special"><-</span> to-mu in, buf <span id="L580" class="LineNr">580 </span> out <span class="Special"><-</span> <a href='061text.mu.html#L328'>buffer-to-array</a> buf <span id="L581" class="LineNr">581 </span>] <span id="L582" class="LineNr">582 </span> -<span id="L583" class="LineNr">583 </span><span class="muRecipe">def</span> to-mu in:&:<a href='lambda-to-mu.mu.html#L31'>cell</a>, buf:&:buffer<span class="muRecipe"> -> </span>buf:&:buffer, result-name:text [ +<span id="L583" class="LineNr">583 </span><span class="muRecipe">def</span> to-mu in:&:<a href='lambda-to-mu.mu.html#L31'>cell</a>, buf:&:<a href='061text.mu.html#L126'>buffer</a><span class="muRecipe"> -> </span>buf:&:<a href='061text.mu.html#L126'>buffer</a>, result-name:text [ <span id="L584" class="LineNr">584 </span> <span class="Constant">local-scope</span> <span id="L585" class="LineNr">585 </span> <span class="Constant">load-ingredients</span> <span id="L586" class="LineNr">586 </span> <span class="Comment"># null cell? no change.</span> diff --git a/html/nqueens.mu.html b/html/nqueens.mu.html index 1c89c974..0e10c100 100644 --- a/html/nqueens.mu.html +++ b/html/nqueens.mu.html @@ -69,7 +69,7 @@ if ('onhashchange' in window) { <span id="L8" class="LineNr"> 8 </span> file:num <span id="L9" class="LineNr"> 9 </span>] <span id="L10" class="LineNr">10 </span> -<span id="L11" class="LineNr">11 </span><span class="muRecipe">def</span> <a href='nqueens.mu.html#L11'>nqueens</a> n:num, queens:&:list:<a href='nqueens.mu.html#L6'>square</a><span class="muRecipe"> -> </span>result:num, queens:&:list:<a href='nqueens.mu.html#L6'>square</a> [ +<span id="L11" class="LineNr">11 </span><span class="muRecipe">def</span> <a href='nqueens.mu.html#L11'>nqueens</a> n:num, queens:&:<a href='064list.mu.html#L6'>list</a>:<a href='nqueens.mu.html#L6'>square</a><span class="muRecipe"> -> </span>result:num, queens:&:<a href='064list.mu.html#L6'>list</a>:<a href='nqueens.mu.html#L6'>square</a> [ <span id="L12" class="LineNr">12 </span> <span class="Constant">local-scope</span> <span id="L13" class="LineNr">13 </span> <span class="Constant">load-ingredients</span> <span id="L14" class="LineNr">14 </span> <span class="Comment"># if 'queens' is already long enough, print it and return</span> @@ -97,7 +97,7 @@ if ('onhashchange' in window) { <span id="L36" class="LineNr">36 </span> <span class="Conceal">¦</span> <span class="Delimiter">{</span> <span id="L37" class="LineNr">37 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> curr-conflicts?:bool <span class="Special"><-</span> <a href='nqueens.mu.html#L49'>conflict?</a> curr, queens <span id="L38" class="LineNr">38 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> <span class="muControl">break-if</span> curr-conflicts? -<span id="L39" class="LineNr">39 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> queens:&:list:<a href='nqueens.mu.html#L6'>square</a> <span class="Special"><-</span> push curr, queens +<span id="L39" class="LineNr">39 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> queens:&:<a href='064list.mu.html#L6'>list</a>:<a href='nqueens.mu.html#L6'>square</a> <span class="Special"><-</span> push curr, queens <span id="L40" class="LineNr">40 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> sub-result:num <span class="Special"><-</span> <a href='nqueens.mu.html#L11'>nqueens</a> n, queens <span id="L41" class="LineNr">41 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> result <span class="Special"><-</span> add result, sub-result <span id="L42" class="LineNr">42 </span> <span class="Conceal">¦</span> <span class="Conceal">¦</span> queens <span class="Special"><-</span> <a href='064list.mu.html#L25'>rest</a> queens @@ -107,7 +107,7 @@ if ('onhashchange' in window) { <span id="L46" class="LineNr">46 </span> <span class="Delimiter">}</span> <span id="L47" class="LineNr">47 </span>] <span id="L48" class="LineNr">48 </span> -<span id="L49" class="LineNr">49 </span><span class="muRecipe">def</span> <a href='nqueens.mu.html#L49'>conflict?</a> curr:<a href='nqueens.mu.html#L6'>square</a>, queens:&:list:<a href='nqueens.mu.html#L6'>square</a><span class="muRecipe"> -> </span>result:bool [ +<span id="L49" class="LineNr">49 </span><span class="muRecipe">def</span> <a href='nqueens.mu.html#L49'>conflict?</a> curr:<a href='nqueens.mu.html#L6'>square</a>, queens:&:<a href='064list.mu.html#L6'>list</a>:<a href='nqueens.mu.html#L6'>square</a><span class="muRecipe"> -> </span>result:bool [ <span id="L50" class="LineNr">50 </span> <span class="Constant">local-scope</span> <span id="L51" class="LineNr">51 </span> <span class="Constant">load-ingredients</span> <span id="L52" class="LineNr">52 </span> result1:bool <span class="Special"><-</span> <a href='nqueens.mu.html#L58'>conflicting-file?</a> curr, queens @@ -116,7 +116,7 @@ if ('onhashchange' in window) { <span id="L55" class="LineNr">55 </span> <span class="muControl">return</span> result2 <span id="L56" class="LineNr">56 </span>] <span id="L57" class="LineNr">57 </span> -<span id="L58" class="LineNr">58 </span><span class="muRecipe">def</span> <a href='nqueens.mu.html#L58'>conflicting-file?</a> curr:<a href='nqueens.mu.html#L6'>square</a>, queens:&:list:<a href='nqueens.mu.html#L6'>square</a><span class="muRecipe"> -> </span>result:bool [ +<span id="L58" class="LineNr">58 </span><span class="muRecipe">def</span> <a href='nqueens.mu.html#L58'>conflicting-file?</a> curr:<a href='nqueens.mu.html#L6'>square</a>, queens:&:<a href='064list.mu.html#L6'>list</a>:<a href='nqueens.mu.html#L6'>square</a><span class="muRecipe"> -> </span>result:bool [ <span id="L59" class="LineNr">59 </span> <span class="Constant">local-scope</span> <span id="L60" class="LineNr">60 </span> <span class="Constant">load-ingredients</span> <span id="L61" class="LineNr">61 </span> curr-file:num <span class="Special"><-</span> get curr, <span class="Constant">file:offset</span> @@ -132,7 +132,7 @@ if ('onhashchange' in window) { <span id="L71" class="LineNr">71 </span> <span class="muControl">return</span> <span class="Constant">0/no-conflict-found</span> <span id="L72" class="LineNr">72 </span>] <span id="L73" class="LineNr">73 </span> -<span id="L74" class="LineNr">74 </span><span class="muRecipe">def</span> <a href='nqueens.mu.html#L74'>conflicting-diagonal?</a> curr:<a href='nqueens.mu.html#L6'>square</a>, queens:&:list:<a href='nqueens.mu.html#L6'>square</a><span class="muRecipe"> -> </span>result:bool [ +<span id="L74" class="LineNr">74 </span><span class="muRecipe">def</span> <a href='nqueens.mu.html#L74'>conflicting-diagonal?</a> curr:<a href='nqueens.mu.html#L6'>square</a>, queens:&:<a href='064list.mu.html#L6'>list</a>:<a href='nqueens.mu.html#L6'>square</a><span class="muRecipe"> -> </span>result:bool [ <span id="L75" class="LineNr">75 </span> <span class="Constant">local-scope</span> <span id="L76" class="LineNr">76 </span> <span class="Constant">load-ingredients</span> <span id="L77" class="LineNr">77 </span> curr-rank:num <span class="Special"><-</span> get curr, <span class="Constant">rank:offset</span> |