diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2016-12-27 22:20:43 -0800 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2016-12-27 22:20:43 -0800 |
commit | 97eb971b7574b3f283d7111a567a301faec9912d (patch) | |
tree | 4a1f9d1987ca601efba78865c8b3d1766d23af92 /html/nqueens.mu.html | |
parent | df0c0babff599b0ab85f56cd50ee0b4143f12886 (diff) | |
download | mu-97eb971b7574b3f283d7111a567a301faec9912d.tar.gz |
3725
More improvements to cross-linking example programs. Include their own functions as well in the tags for each program, even as you share the core .mu files everywhere.
Diffstat (limited to 'html/nqueens.mu.html')
-rw-r--r-- | html/nqueens.mu.html | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/html/nqueens.mu.html b/html/nqueens.mu.html index e0c4da82..6035fb3d 100644 --- a/html/nqueens.mu.html +++ b/html/nqueens.mu.html @@ -62,12 +62,12 @@ if ('onhashchange' in window) { <span id="L3" class="LineNr"> 3 </span><span class="Comment"># run with tracing turned on:</span> <span id="L4" class="LineNr"> 4 </span><span class="Comment"># ./mu --trace nqueens.mu</span> <span id="L5" class="LineNr"> 5 </span> -<span id="L6" class="LineNr"> 6 </span><span class="muData">container</span> square [ +<span id="L6" class="LineNr"> 6 </span><span class="muData">container</span> <a href='nqueens.mu.html#L6'>square</a> [ <span id="L7" class="LineNr"> 7 </span> rank:num <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> nqueens n:num, queens:&:list:square<span class="muRecipe"> -> </span>result:num, queens:&:list:square [ +<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="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> @@ -82,7 +82,7 @@ if ('onhashchange' in window) { <span id="L23" class="LineNr">23 </span> next-rank:num <span class="Special"><-</span> copy<span class="Constant"> 0</span> <span id="L24" class="LineNr">24 </span> <span class="Delimiter">{</span> <span id="L25" class="LineNr">25 </span> <span class="muControl">break-unless</span> queens -<span id="L26" class="LineNr">26 </span> first:square <span class="Special"><-</span> first queens +<span id="L26" class="LineNr">26 </span> first:<a href='nqueens.mu.html#L6'>square</a> <span class="Special"><-</span> first queens <span id="L27" class="LineNr">27 </span> existing-rank:num <span class="Special"><-</span> get first, <span class="Constant">rank:offset</span> <span id="L28" class="LineNr">28 </span> next-rank <span class="Special"><-</span> add existing-rank,<span class="Constant"> 1</span> <span id="L29" class="LineNr">29 </span> <span class="Delimiter">}</span> @@ -91,12 +91,12 @@ if ('onhashchange' in window) { <span id="L32" class="LineNr">32 </span> <span class="Delimiter">{</span> <span id="L33" class="LineNr">33 </span> done?:bool <span class="Special"><-</span> greater-or-equal next-file, n <span id="L34" class="LineNr">34 </span> <span class="muControl">break-if</span> done? -<span id="L35" class="LineNr">35 </span> curr:square <span class="Special"><-</span> merge next-rank, next-file +<span id="L35" class="LineNr">35 </span> curr:<a href='nqueens.mu.html#L6'>square</a> <span class="Special"><-</span> merge next-rank, next-file <span id="L36" class="LineNr">36 </span> <span class="Delimiter">{</span> -<span id="L37" class="LineNr">37 </span> curr-conflicts?:bool <span class="Special"><-</span> conflict? curr, queens +<span id="L37" class="LineNr">37 </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="muControl">break-if</span> curr-conflicts? -<span id="L39" class="LineNr">39 </span> queens:&:list:square <span class="Special"><-</span> push curr, queens -<span id="L40" class="LineNr">40 </span> sub-result:num <span class="Special"><-</span> nqueens n, queens +<span id="L39" class="LineNr">39 </span> queens:&:list:<a href='nqueens.mu.html#L6'>square</a> <span class="Special"><-</span> push curr, queens +<span id="L40" class="LineNr">40 </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> result <span class="Special"><-</span> add result, sub-result <span id="L42" class="LineNr">42 </span> queens <span class="Special"><-</span> <a href='064list.mu.html#L25'>rest</a> queens <span id="L43" class="LineNr">43 </span> <span class="Delimiter">}</span> @@ -105,22 +105,22 @@ 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> conflict? curr:square, queens:&:list:square<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:&:list:<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> conflicting-file? curr, queens +<span id="L52" class="LineNr">52 </span> result1:bool <span class="Special"><-</span> <a href='nqueens.mu.html#L58'>conflicting-file?</a> curr, queens <span id="L53" class="LineNr">53 </span> <span class="muControl">return-if</span> result1, result1 -<span id="L54" class="LineNr">54 </span> result2:bool <span class="Special"><-</span> conflicting-diagonal? curr, queens +<span id="L54" class="LineNr">54 </span> result2:bool <span class="Special"><-</span> <a href='nqueens.mu.html#L74'>conflicting-diagonal?</a> curr, queens <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> conflicting-file? curr:square, queens:&:list:square<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:&:list:<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> <span id="L62" class="LineNr">62 </span> <span class="Delimiter">{</span> <span id="L63" class="LineNr">63 </span> <span class="muControl">break-unless</span> queens -<span id="L64" class="LineNr">64 </span> q:square <span class="Special"><-</span> first queens +<span id="L64" class="LineNr">64 </span> q:<a href='nqueens.mu.html#L6'>square</a> <span class="Special"><-</span> first queens <span id="L65" class="LineNr">65 </span> qfile:num <span class="Special"><-</span> get q, <span class="Constant">file:offset</span> <span id="L66" class="LineNr">66 </span> file-match?:bool <span class="Special"><-</span> equal curr-file, qfile <span id="L67" class="LineNr">67 </span> <span class="muControl">return-if</span> file-match?, <span class="Constant">1/conflict-found</span> @@ -130,14 +130,14 @@ 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> conflicting-diagonal? curr:square, queens:&:list:square<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:&:list:<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> <span id="L78" class="LineNr">78 </span> curr-file:num <span class="Special"><-</span> get curr, <span class="Constant">file:offset</span> <span id="L79" class="LineNr">79 </span> <span class="Delimiter">{</span> <span id="L80" class="LineNr">80 </span> <span class="muControl">break-unless</span> queens -<span id="L81" class="LineNr">81 </span> q:square <span class="Special"><-</span> first queens +<span id="L81" class="LineNr">81 </span> q:<a href='nqueens.mu.html#L6'>square</a> <span class="Special"><-</span> first queens <span id="L82" class="LineNr">82 </span> qrank:num <span class="Special"><-</span> get q, <span class="Constant">rank:offset</span> <span id="L83" class="LineNr">83 </span> qfile:num <span class="Special"><-</span> get q, <span class="Constant">file:offset</span> <span id="L84" class="LineNr">84 </span> rank-delta:num <span class="Special"><-</span> subtract qrank, curr-rank @@ -152,8 +152,8 @@ if ('onhashchange' in window) { <span id="L93" class="LineNr">93 </span> <span class="muControl">return</span> <span class="Constant">0/no-conflict-found</span> <span id="L94" class="LineNr">94 </span>] <span id="L95" class="LineNr">95 </span> -<span id="L96" class="LineNr">96 </span><span class="muRecipe">def</span> main [ -<span id="L97" class="LineNr">97 </span> nqueens<span class="Constant"> 4</span> +<span id="L96" class="LineNr">96 </span><span class="muRecipe">def</span> <a href='nqueens.mu.html#L96'>main</a> [ +<span id="L97" class="LineNr">97 </span> <a href='nqueens.mu.html#L11'>nqueens</a><span class="Constant"> 4</span> <span id="L98" class="LineNr">98 </span> $dump-trace <span class="Constant">[app]</span> <span id="L99" class="LineNr">99 </span>] </pre> |