aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarshall Lochbaum <mwlochbaum@gmail.com>2022-07-14 21:02:14 -0400
committerMarshall Lochbaum <mwlochbaum@gmail.com>2022-07-14 21:08:18 -0400
commit5e81613ac137c5641675ceb792ca105d345d98c6 (patch)
treee91a84cbd337bb87161d68f45f981f73d4bdd0f5
parente2b07a5fd0bbaad232c717fb90a31d6c61d72bd4 (diff)
Handle transitive dependencies in REPL link code
-rw-r--r--docs/doc/lexical.html2
-rw-r--r--docs/doc/match.html2
-rw-r--r--docs/doc/quick.html22
-rw-r--r--docs/tutorial/variable.html8
-rw-r--r--md.bqn42
5 files changed, 43 insertions, 33 deletions
diff --git a/docs/doc/lexical.html b/docs/doc/lexical.html
index 6ff7f51e..141bef45 100644
--- a/docs/doc/lexical.html
+++ b/docs/doc/lexical.html
@@ -90,7 +90,7 @@
<p>Why define things this way? It's easier to see if you imagine the variable used is also a function. It's normal for a function to call other functions defined at the top level, of course. And it would be pretty unpleasant for BQN to enforce a specific ordering for them. It would also make recursive functions impossible except by using <code><span class='Function'>𝕊</span></code>, and mutually recursive ones completely impossible. A simple rule that makes all these things just work smoothly seems much better than any alternative.</p>
<h2 id="closures"><a class="header" href="#closures">Closures</a></h2>
<p>Let's run <code><span class='Modifier'>_makeCount</span></code> from above a few more times.</p>
-<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=X21ha2VDb3VudCDihpAgeyBjb3VudGVy4oC/aW5j4oaQ8J2VlyDii4QgeyBjb3VudGVyICvihqkg8J2VqSDDlyBpbmMgfSB9CkMzXzcg4oaQIDPigL83IF9tYWtlQ291bnQgICMgU3RhcnQgYXQgMzsgaW5jIGJ5IDcKQzRfMiDihpAgNOKAvzIgX21ha2VDb3VudCAgIyBTdGFydCBhdCA0OyBpbmNyZW1lbnQgYnkgMgpDMV80IOKGkCAx4oC/NCBfbWFrZUNvdW50ICAjICAgICAgICAgIDE7ICAgICAgICAgICAgICA0CgpDNF8yIDAKQzFfNCAwCkM0XzIgMTAKQzFfNCAxMApDNF8yIDAKQzNfNyAwICAjIFRoZSBmaXJzdCBvbmUncyBzdGlsbCBhcm91bmQgdG9v">↗️</a><pre> <span class='Function'>C4_2</span> <span class='Gets'>←</span> <span class='Number'>4</span><span class='Ligature'>‿</span><span class='Number'>2</span> <span class='Modifier'>_makeCount</span> <span class='Comment'># Start at 4; increment by 2
+<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=Y291bnRlciDihpAgMAppbmMg4oaQIDYKX21ha2VDb3VudCDihpAgeyBjb3VudGVy4oC/aW5j4oaQ8J2VlyDii4QgeyBjb3VudGVyICvihqkg8J2VqSDDlyBpbmMgfSB9CkMzXzcg4oaQIDPigL83IF9tYWtlQ291bnQgICMgU3RhcnQgYXQgMzsgaW5jIGJ5IDcKQzRfMiDihpAgNOKAvzIgX21ha2VDb3VudCAgIyBTdGFydCBhdCA0OyBpbmNyZW1lbnQgYnkgMgpDMV80IOKGkCAx4oC/NCBfbWFrZUNvdW50ICAjICAgICAgICAgIDE7ICAgICAgICAgICAgICA0CgpDNF8yIDAKQzFfNCAwCkM0XzIgMTAKQzFfNCAxMApDNF8yIDAKQzNfNyAwICAjIFRoZSBmaXJzdCBvbmUncyBzdGlsbCBhcm91bmQgdG9v">↗️</a><pre> <span class='Function'>C4_2</span> <span class='Gets'>←</span> <span class='Number'>4</span><span class='Ligature'>‿</span><span class='Number'>2</span> <span class='Modifier'>_makeCount</span> <span class='Comment'># Start at 4; increment by 2
</span> <span class='Function'>C1_4</span> <span class='Gets'>←</span> <span class='Number'>1</span><span class='Ligature'>‿</span><span class='Number'>4</span> <span class='Modifier'>_makeCount</span> <span class='Comment'># 1; 4
</span>
<span class='Function'>C4_2</span> <span class='Number'>0</span>
diff --git a/docs/doc/match.html b/docs/doc/match.html
index 13568805..d5cddee2 100644
--- a/docs/doc/match.html
+++ b/docs/doc/match.html
@@ -92,7 +92,7 @@
⟨ 8 12 ⟩
</pre>
<p>These functions both have the definition <code><span class='Brace'>{</span><span class='Value'>a</span><span class='Function'>×</span><span class='Value'>𝕩</span><span class='Brace'>}</span></code>, but give different results! They are different <em>instances</em> of the same block, and have different environments: for <code><span class='Function'>T2</span></code>, <code><span class='Value'>a</span></code> is <code><span class='Number'>2</span></code>, and for <code><span class='Function'>T3</span></code>, it's <code><span class='Number'>3</span></code>.</p>
-<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=dDIg4oaQIEdlbiAyCnQzIOKGkCBHZW4gMwp0MiA9IHQz">↗️</a><pre> <span class='Value'>t2</span> <span class='Function'>=</span> <span class='Value'>t3</span>
+<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=R2VuIOKGkCB7IGHihpDwnZWpIOKLhCB7YcOX8J2VqX0gfQp0MiDihpAgR2VuIDIKdDMg4oaQIEdlbiAzCnQyID0gdDM=">↗️</a><pre> <span class='Value'>t2</span> <span class='Function'>=</span> <span class='Value'>t3</span>
0
</pre>
<p>Some definitions should help to make things clearer. A &quot;block&quot; is not actually a BQN value, but a region of source code enclosed in <code><span class='Brace'>{}</span></code> brackets. When the program encounters a block function or modifier, it creates an instance of this block, and then uses this instance in the rest of the expression (actually, an immediate block also creates an instance, but this instance is immediately run, and discarded when it finishes, so it can't be accessed as a value). Every time the function <code><span class='Function'>Gen</span></code> is run, it evaluates the statements it contains, and the second statement <code><span class='Brace'>{</span><span class='Value'>a</span><span class='Function'>×</span><span class='Value'>𝕩</span><span class='Brace'>}</span></code> creates a block instance. So <code><span class='Function'>Gen</span></code> creates a new block instance each time. This is necessary for <code><span class='Function'>Gen</span></code> to work correctly: each time it runs, it creates a new scope, so it needs to create a new function that will be tied to that scope.</p>
diff --git a/docs/doc/quick.html b/docs/doc/quick.html
index af70a7b7..cbda94a9 100644
--- a/docs/doc/quick.html
+++ b/docs/doc/quick.html
@@ -138,7 +138,7 @@
<pre><span class='Value'>hw</span> <span class='Value'>case.</span><span class='Function'>Upper</span><span class='Modifier2'>⌾</span><span class='Paren'>(</span><span class='Function'>⊑</span><span class='Modifier'>¨</span><span class='Paren'>)</span><span class='Gets'>↩</span>
</pre>
<p>This statement consists of the name <code><span class='Value'>hw</span></code> just defined, a compound function, and then the new character <code><span class='Gets'>↩</span></code>. This is another form of <a href="expression.html#assignment">assignment</a>, like <code><span class='Gets'>←</span></code>, but it changes the value of an existing variable instead of defining a new one. There's also some special <code><span class='Gets'>↩</span></code> syntax here: the expression <code><span class='Value'>val</span> <span class='Function'>Fn</span><span class='Gets'>↩</span></code> is shorthand for <code><span class='Value'>val</span> <span class='Gets'>↩</span> <span class='Function'>Fn</span> <span class='Value'>val</span></code>, avoiding the need to write the name <code><span class='Value'>hw</span></code> twice (and <code><span class='Value'>val</span> <span class='Function'>Fn</span><span class='Gets'>↩</span> <span class='Value'>arg</span></code> means <code><span class='Value'>val</span> <span class='Gets'>↩</span> <span class='Value'>val</span> <span class='Function'>Fn</span> <span class='Value'>arg</span></code>, like <code><span class='Function'>+=</span></code> and so on from C). So we are modifying <code><span class='Value'>hw</span></code> by applying this function <code><span class='Value'>case.</span><span class='Function'>Upper</span><span class='Modifier2'>⌾</span><span class='Paren'>(</span><span class='Function'>⊑</span><span class='Modifier'>¨</span><span class='Paren'>)</span></code>.</p>
-<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=aHcg4oaQIDzLmCAy4oC/4oiYIOKliiAiaGVsbG93b3JsZCIKCmNhc2UuVXBwZXLijL4o4oqRwqgpIGh3CgpodyBjYXNlLlVwcGVy4oy+KOKKkcKoKeKGqSAgIyBTZXRzIG5ldyB2YWx1ZSBmb3IgaHc=">↗️</a><pre> <span class='Value'>hw</span> <span class='Gets'>←</span> <span class='Function'>&lt;</span><span class='Modifier'>˘</span> <span class='Number'>2</span><span class='Ligature'>‿</span><span class='Modifier2'>∘</span> <span class='Function'>⥊</span> <span class='String'>&quot;helloworld&quot;</span>
+<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=Y2FzZSDihpAgewogIGRpZmYg4oaQIC3CtCAiQWEiCiAgTG93ZXIg4oeQIC3in5xkaWZmCiAgVXBwZXIg4oeQIExvd2Vy4oG8Cn0KaHcg4oaQIDzLmCAy4oC/4oiYIOKliiAiaGVsbG93b3JsZCIKCmNhc2UuVXBwZXLijL4o4oqRwqgpIGh3CgpodyBjYXNlLlVwcGVy4oy+KOKKkcKoKeKGqSAgIyBTZXRzIG5ldyB2YWx1ZSBmb3IgaHc=">↗️</a><pre> <span class='Value'>hw</span> <span class='Gets'>←</span> <span class='Function'>&lt;</span><span class='Modifier'>˘</span> <span class='Number'>2</span><span class='Ligature'>‿</span><span class='Modifier2'>∘</span> <span class='Function'>⥊</span> <span class='String'>&quot;helloworld&quot;</span>
<span class='Value'>case.</span><span class='Function'>Upper</span><span class='Modifier2'>⌾</span><span class='Paren'>(</span><span class='Function'>⊑</span><span class='Modifier'>¨</span><span class='Paren'>)</span> <span class='Value'>hw</span>
⟨ "Hello" "World" ⟩
@@ -147,14 +147,14 @@
</span>⟨ "Hello" "World" ⟩
</pre>
<p>That converts the first character of each string to uppercase! <code><span class='Value'>case.</span><span class='Function'>Upper</span></code> is the case conversion function defined before, so that part makes sense. The rest of the function, <code><span class='Modifier2'>⌾</span><span class='Paren'>(</span><span class='Function'>⊑</span><span class='Modifier'>¨</span><span class='Paren'>)</span></code>, would be pronounced &quot;<a href="under.html">Under</a> the <a href="pick.html#first">First</a> of <a href="map.html#one-argument-mapping">Each</a>&quot;, which… pretty much makes sense too? The First Each function extracts the first element of each list in <code><span class='Value'>hw</span></code>, the part that used to be <code><span class='String'>&quot;hw&quot;</span></code> but is now <code><span class='String'>&quot;HW&quot;</span></code>.</p>
-<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=aHcg4oaQIDzLmCAy4oC/4oiYIOKliiAiaGVsbG93b3JsZCIKaHcgY2FzZS5VcHBlcuKMvijiipHCqCnihqkgICMgU2V0cyBuZXcgdmFsdWUgZm9yIGh3CuKKkcKoIGh3CgpjYXNlLlVwcGVyICJodyI=">↗️</a><pre> <span class='Function'>⊑</span><span class='Modifier'>¨</span> <span class='Value'>hw</span>
+<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=Y2FzZSDihpAgewogIGRpZmYg4oaQIC3CtCAiQWEiCiAgTG93ZXIg4oeQIC3in5xkaWZmCiAgVXBwZXIg4oeQIExvd2Vy4oG8Cn0KaHcg4oaQIDzLmCAy4oC/4oiYIOKliiAiaGVsbG93b3JsZCIKaHcgY2FzZS5VcHBlcuKMvijiipHCqCnihqkgICMgU2V0cyBuZXcgdmFsdWUgZm9yIGh3CuKKkcKoIGh3CgpjYXNlLlVwcGVyICJodyI=">↗️</a><pre> <span class='Function'>⊑</span><span class='Modifier'>¨</span> <span class='Value'>hw</span>
"HW"
<span class='Value'>case.</span><span class='Function'>Upper</span> <span class='String'>&quot;hw&quot;</span>
"HW"
</pre>
<p>The Under modifier keeps track of where that string came from and puts it <em>back</em>, to produce a new, altered array. It's kind of special, like Undo, but works on all sorts of fancy selections. It's also worth pointing out that <code><span class='Value'>case.</span><span class='Function'>Upper</span></code> applies to a string here, not an individual character. That's because arithmetic is <a href="arithmetic.html#pervasion">pervasive</a>, so that functions made of arithmetic naturally work on arrays. Although in this case it wasn't really necessary, because it's also possible to map over the two strings and uppercase the first character of each separately:</p>
-<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=Y2FzZS5VcHBlcuKMvuKKkcKoICJoZWxsbyLigL8id29ybGQi">↗️</a><pre> <span class='Value'>case.</span><span class='Function'>Upper</span><span class='Modifier2'>⌾</span><span class='Function'>⊑</span><span class='Modifier'>¨</span> <span class='String'>&quot;hello&quot;</span><span class='Ligature'>‿</span><span class='String'>&quot;world&quot;</span>
+<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=Y2FzZSDihpAgewogIGRpZmYg4oaQIC3CtCAiQWEiCiAgTG93ZXIg4oeQIC3in5xkaWZmCiAgVXBwZXIg4oeQIExvd2Vy4oG8Cn0KY2FzZS5VcHBlcuKMvuKKkcKoICJoZWxsbyLigL8id29ybGQi">↗️</a><pre> <span class='Value'>case.</span><span class='Function'>Upper</span><span class='Modifier2'>⌾</span><span class='Function'>⊑</span><span class='Modifier'>¨</span> <span class='String'>&quot;hello&quot;</span><span class='Ligature'>‿</span><span class='String'>&quot;world&quot;</span>
⟨ "Hello" "World" ⟩
</pre>
<p>Modifiers are applied from left to right, opposite to functions (1-modifiers also take the operand on the left while prefix functions have the argument on the right). So <code><span class='Value'>case.</span><span class='Function'>Upper</span><span class='Modifier2'>⌾</span><span class='Function'>⊑</span><span class='Modifier'>¨</span></code> means <code><span class='Paren'>(</span><span class='Value'>case.</span><span class='Function'>Upper</span><span class='Modifier2'>⌾</span><span class='Function'>⊑</span><span class='Paren'>)</span><span class='Modifier'>¨</span></code>.</p>
@@ -163,14 +163,14 @@
<pre><span class='Function'>•Out</span> <span class='Value'>hw</span> <span class='Gets'>↩</span> <span class='Function'>∾</span> <span class='Function'>⥊⍉</span> <span class='Bracket'>[</span><span class='Value'>hw</span><span class='Separator'>,</span> <span class='String'>&quot;, &quot;</span><span class='Ligature'>‿</span><span class='String'>&quot;!&quot;</span><span class='Bracket'>]</span> <span class='Comment'># Hello, World!
</span></pre>
<p>None of these functions have a subject to the left, so they're all evaluated as prefix functions. But first, we have the <a href="arrayrepr.html#high-rank-arrays">array notation</a> <code><span class='Bracket'>[]</span></code>. This syntax forms an array from its major cells <code><span class='Value'>hw</span></code> and <code><span class='String'>&quot;, &quot;</span><span class='Ligature'>‿</span><span class='String'>&quot;!&quot;</span></code> (another strand, a list of two strings). Because the major cells are both lists, we have another rank 2 array.</p>
-<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=aHcg4oaQIDzLmCAy4oC/4oiYIOKliiAiaGVsbG93b3JsZCIKaHcgY2FzZS5VcHBlcuKMvijiipHCqCnihqkgICMgU2V0cyBuZXcgdmFsdWUgZm9yIGh3CltodywgIiwgIuKAvyIhIl0=">↗️</a><pre> <span class='Bracket'>[</span><span class='Value'>hw</span><span class='Separator'>,</span> <span class='String'>&quot;, &quot;</span><span class='Ligature'>‿</span><span class='String'>&quot;!&quot;</span><span class='Bracket'>]</span>
+<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=Y2FzZSDihpAgewogIGRpZmYg4oaQIC3CtCAiQWEiCiAgTG93ZXIg4oeQIC3in5xkaWZmCiAgVXBwZXIg4oeQIExvd2Vy4oG8Cn0KaHcg4oaQIDzLmCAy4oC/4oiYIOKliiAiaGVsbG93b3JsZCIKaHcgY2FzZS5VcHBlcuKMvijiipHCqCnihqkgICMgU2V0cyBuZXcgdmFsdWUgZm9yIGh3CltodywgIiwgIuKAvyIhIl0=">↗️</a><pre> <span class='Bracket'>[</span><span class='Value'>hw</span><span class='Separator'>,</span> <span class='String'>&quot;, &quot;</span><span class='Ligature'>‿</span><span class='String'>&quot;!&quot;</span><span class='Bracket'>]</span>
┌─
╵ "Hello" "World"
", " "!"
</pre>
<p>The reason for forming this array is to interleave the elements, or we might say to read down the columns rather than across the rows. This ordering is done with a <a href="transpose.html">Transpose</a> to exchange the two axes, then a <a href="reshape.html#deshape">Deshape</a> to flatten it out, giving a list.</p>
-<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=aHcg4oaQIDzLmCAy4oC/4oiYIOKliiAiaGVsbG93b3JsZCIKaHcgY2FzZS5VcHBlcuKMvijiipHCqCnihqkgICMgU2V0cyBuZXcgdmFsdWUgZm9yIGh3CuKNiSBbaHcsICIsICLigL8iISJdCgripYog4o2JIFtodywgIiwgIuKAvyIhIl0=">↗️</a><pre> <span class='Function'>⍉</span> <span class='Bracket'>[</span><span class='Value'>hw</span><span class='Separator'>,</span> <span class='String'>&quot;, &quot;</span><span class='Ligature'>‿</span><span class='String'>&quot;!&quot;</span><span class='Bracket'>]</span>
+<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=Y2FzZSDihpAgewogIGRpZmYg4oaQIC3CtCAiQWEiCiAgTG93ZXIg4oeQIC3in5xkaWZmCiAgVXBwZXIg4oeQIExvd2Vy4oG8Cn0KaHcg4oaQIDzLmCAy4oC/4oiYIOKliiAiaGVsbG93b3JsZCIKaHcgY2FzZS5VcHBlcuKMvijiipHCqCnihqkgICMgU2V0cyBuZXcgdmFsdWUgZm9yIGh3CuKNiSBbaHcsICIsICLigL8iISJdCgripYog4o2JIFtodywgIiwgIuKAvyIhIl0=">↗️</a><pre> <span class='Function'>⍉</span> <span class='Bracket'>[</span><span class='Value'>hw</span><span class='Separator'>,</span> <span class='String'>&quot;, &quot;</span><span class='Ligature'>‿</span><span class='String'>&quot;!&quot;</span><span class='Bracket'>]</span>
┌─
╵ "Hello" ", "
"World" "!"
@@ -180,7 +180,7 @@
⟨ "Hello" ", " "World" "!" ⟩
</pre>
<p>Finally, <a href="join.html">Join</a> combines this list of strings into a single string.</p>
-<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=aHcg4oaQIDzLmCAy4oC/4oiYIOKliiAiaGVsbG93b3JsZCIKaHcgY2FzZS5VcHBlcuKMvijiipHCqCnihqkgICMgU2V0cyBuZXcgdmFsdWUgZm9yIGh3Cmh3IOKGqSDiiL4g4qWK4o2JIFtodywgIiwgIuKAvyIhIl0KaHc=">↗️</a><pre> <span class='Value'>hw</span> <span class='Gets'>↩</span> <span class='Function'>∾</span> <span class='Function'>⥊⍉</span> <span class='Bracket'>[</span><span class='Value'>hw</span><span class='Separator'>,</span> <span class='String'>&quot;, &quot;</span><span class='Ligature'>‿</span><span class='String'>&quot;!&quot;</span><span class='Bracket'>]</span>
+<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=Y2FzZSDihpAgewogIGRpZmYg4oaQIC3CtCAiQWEiCiAgTG93ZXIg4oeQIC3in5xkaWZmCiAgVXBwZXIg4oeQIExvd2Vy4oG8Cn0KaHcg4oaQIDzLmCAy4oC/4oiYIOKliiAiaGVsbG93b3JsZCIKaHcgY2FzZS5VcHBlcuKMvijiipHCqCnihqkgICMgU2V0cyBuZXcgdmFsdWUgZm9yIGh3Cmh3IOKGqSDiiL4g4qWK4o2JIFtodywgIiwgIuKAvyIhIl0KaHc=">↗️</a><pre> <span class='Value'>hw</span> <span class='Gets'>↩</span> <span class='Function'>∾</span> <span class='Function'>⥊⍉</span> <span class='Bracket'>[</span><span class='Value'>hw</span><span class='Separator'>,</span> <span class='String'>&quot;, &quot;</span><span class='Ligature'>‿</span><span class='String'>&quot;!&quot;</span><span class='Bracket'>]</span>
<span class='Value'>hw</span>
"Hello, World!"
</pre>
@@ -249,7 +249,7 @@
<span class='Paren'>(</span><span class='Function'>∾</span><span class='Modifier'>¨</span> <span class='Function'>GV</span> <span class='Function'>⊔</span><span class='Modifier'>˜</span> <span class='Nothing'>·</span><span class='Function'>+</span><span class='Modifier'>`</span><span class='Function'>GS</span><span class='Paren'>)</span> <span class='Value'>r</span>
</pre>
<p>The first line here applies <code><span class='Function'>Proc</span></code> to each character and the one before it, using <code><span class='String'>' '</span></code> as the character &quot;before&quot; the first. <code><span class='Function'>Proc</span><span class='Brace'>{</span><span class='Function'>»𝔽</span><span class='Modifier'>¨</span><span class='Function'>⊢</span><span class='Brace'>}</span> <span class='Value'>𝕩</span></code> is a fancy way to write <code><span class='Paren'>(</span><span class='Function'>»</span><span class='Value'>𝕩</span><span class='Paren'>)</span> <span class='Function'>Proc</span><span class='Modifier'>¨</span> <span class='Value'>𝕩</span></code>, which we'll explain in a moment. First, here's what the <a href="shift.html">Nudge</a> function <code><span class='Function'>»</span></code> does.</p>
-<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=aHcg4oaQIDzLmCAy4oC/4oiYIOKliiAiaGVsbG93b3JsZCIKaHcgY2FzZS5VcHBlcuKMvijiipHCqCnihqkgICMgU2V0cyBuZXcgdmFsdWUgZm9yIGh3Cmh3IOKGqSDiiL4g4qWK4o2JIFtodywgIiwgIuKAvyIhIl0KaHcKwrtodw==">↗️</a><pre> <span class='Value'>hw</span>
+<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=Y2FzZSDihpAgewogIGRpZmYg4oaQIC3CtCAiQWEiCiAgTG93ZXIg4oeQIC3in5xkaWZmCiAgVXBwZXIg4oeQIExvd2Vy4oG8Cn0KaHcg4oaQIDzLmCAy4oC/4oiYIOKliiAiaGVsbG93b3JsZCIKaHcgY2FzZS5VcHBlcuKMvijiipHCqCnihqkgICMgU2V0cyBuZXcgdmFsdWUgZm9yIGh3Cmh3IOKGqSDiiL4g4qWK4o2JIFtodywgIiwgIuKAvyIhIl0KaHcKwrtodw==">↗️</a><pre> <span class='Value'>hw</span>
"Hello, World!"
<span class='Function'>»</span><span class='Value'>hw</span>
" Hello, World"
@@ -257,7 +257,7 @@
<p>It moves its argument forward by one, adding a space character (the array's <a href="fill.html">fill</a>) but keeping the same length. This gives the previous characters that we want to use for <code><span class='Function'>Proc</span></code>'s left argument. Here <a href="map.html#each">Each</a> is used with two arguments, so that it iterates over them simultaneously, like a &quot;zip&quot; in some languages.</p>
<p>What about the fancy syntax <code><span class='Function'>Proc</span><span class='Brace'>{</span><span class='Function'>»𝔽</span><span class='Modifier'>¨</span><span class='Function'>⊢</span><span class='Brace'>}</span> <span class='Value'>𝕩</span></code>? The block <code><span class='Brace'>{</span><span class='Function'>»𝔽</span><span class='Modifier'>¨</span><span class='Function'>⊢</span><span class='Brace'>}</span></code> is an immediate 1-modifier because it uses <code><span class='Function'>𝔽</span></code> for an <a href="block.html#operands">operand</a> but not the arguments <code><span class='Value'>𝕨</span></code> or <code><span class='Value'>𝕩</span></code>. This means it acts on <code><span class='Function'>Proc</span></code> only, giving <code><span class='Function'>»Proc</span><span class='Modifier'>¨</span><span class='Function'>⊢</span></code>, which is a <a href="train.html">train</a> because it ends in a function <code><span class='Function'>⊢</span></code>. Following the rules for a 3-train, <code><span class='Paren'>(</span><span class='Function'>»Proc</span><span class='Modifier'>¨</span><span class='Function'>⊢</span><span class='Paren'>)</span><span class='Value'>𝕩</span></code> expands to <code><span class='Paren'>(</span><span class='Function'>»</span><span class='Value'>𝕩</span><span class='Paren'>)</span> <span class='Function'>Proc</span><span class='Modifier'>¨</span> <span class='Paren'>(</span><span class='Function'>⊢</span><span class='Value'>𝕩</span><span class='Paren'>)</span></code>, and since <code><span class='Function'>⊢</span></code> is the <a href="identity.html">identity function</a>, <code><span class='Function'>⊢</span><span class='Value'>𝕩</span></code> is <code><span class='Value'>𝕩</span></code>.</p>
<p>Since a display of lots of namespaces isn't too enlightening, we'll skip ahead and show what the results of <code><span class='Function'>GV</span></code> and <code><span class='Function'>GS</span></code> on those lists would be. <code><span class='Function'>GV</span></code> turns each character into a string, except it makes a space into the empty string. <code><span class='Function'>GS</span></code> has a <code><span class='Number'>1</span></code> in the places where we want to split the string.</p>
-<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=aHcg4oaQIDzLmCAy4oC/4oiYIOKliiAiaGVsbG93b3JsZCIKaHcgY2FzZS5VcHBlcuKMvijiipHCqCnihqkgICMgU2V0cyBuZXcgdmFsdWUgZm9yIGh3Cmh3IOKGqSDiiL4g4qWK4o2JIFtodywgIiwgIuKAvyIhIl0Kc3Ag4oaQICcgJz1odwpndiDihpAgKDEtc3ApIOKlisKoIGh3CmdzIOKGkCBzcCDiiKggwrviirg9IGh3CgpndgoKZ3M=">↗️</a><pre> <span class='Value'>sp</span> <span class='Gets'>←</span> <span class='String'>' '</span><span class='Function'>=</span><span class='Value'>hw</span>
+<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=Y2FzZSDihpAgewogIGRpZmYg4oaQIC3CtCAiQWEiCiAgTG93ZXIg4oeQIC3in5xkaWZmCiAgVXBwZXIg4oeQIExvd2Vy4oG8Cn0KaHcg4oaQIDzLmCAy4oC/4oiYIOKliiAiaGVsbG93b3JsZCIKaHcgY2FzZS5VcHBlcuKMvijiipHCqCnihqkgICMgU2V0cyBuZXcgdmFsdWUgZm9yIGh3Cmh3IOKGqSDiiL4g4qWK4o2JIFtodywgIiwgIuKAvyIhIl0Kc3Ag4oaQICcgJz1odwpndiDihpAgKDEtc3ApIOKlisKoIGh3CmdzIOKGkCBzcCDiiKggwrviirg9IGh3CgpndgoKZ3M=">↗️</a><pre> <span class='Value'>sp</span> <span class='Gets'>←</span> <span class='String'>' '</span><span class='Function'>=</span><span class='Value'>hw</span>
<span class='Value'>gv</span> <span class='Gets'>←</span> <span class='Paren'>(</span><span class='Number'>1</span><span class='Function'>-</span><span class='Value'>sp</span><span class='Paren'>)</span> <span class='Function'>⥊</span><span class='Modifier'>¨</span> <span class='Value'>hw</span>
<span class='Value'>gs</span> <span class='Gets'>←</span> <span class='Value'>sp</span> <span class='Function'>∨</span> <span class='Function'>»</span><span class='Modifier2'>⊸</span><span class='Function'>=</span> <span class='Value'>hw</span>
@@ -312,18 +312,18 @@
</svg>
<p>There are actually three train groupings here: from right to left, <code><span class='Nothing'>·</span><span class='Function'>+</span><span class='Modifier'>`</span><span class='Function'>GS</span></code>, <code><span class='Function'>GV</span> <span class='Function'>⊔</span><span class='Modifier'>˜</span> <span class='Value'>…</span></code>, and <code><span class='Function'>∾</span><span class='Modifier'>¨</span> <span class='Value'>…</span></code>. Two of them are 2-trains, which apply one function to the result of another, but the one with <code><span class='Function'>⊔</span></code> is a 3-train, applying a function to two results. In the end, functions <code><span class='Function'>GS</span></code> and <code><span class='Function'>GV</span></code> are applied to <code><span class='Value'>r</span></code>. In fact, to evaluate the entire train we can replace these two functions with their results, giving <code><span class='Function'>∾</span><span class='Modifier'>¨</span> <span class='Paren'>(</span><span class='Function'>GV</span> <span class='Value'>r</span><span class='Paren'>)</span> <span class='Function'>⊔</span><span class='Modifier'>˜</span> <span class='Nothing'>·</span><span class='Function'>+</span><span class='Modifier'>`</span><span class='Paren'>(</span><span class='Function'>GS</span> <span class='Value'>r</span><span class='Paren'>)</span></code>.</p>
-<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=Z3Yg4oaQICgxLXNwKSDipYrCqCBodwpncyDihpAgc3Ag4oioIMK74oq4PSBodwriiL7CqCBndiDiipTLnCDCtytgZ3M=">↗️</a><pre> <span class='Function'>∾</span><span class='Modifier'>¨</span> <span class='Value'>gv</span> <span class='Function'>⊔</span><span class='Modifier'>˜</span> <span class='Nothing'>·</span><span class='Function'>+</span><span class='Modifier'>`</span><span class='Value'>gs</span>
+<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=Y2FzZSDihpAgewogIGRpZmYg4oaQIC3CtCAiQWEiCiAgTG93ZXIg4oeQIC3in5xkaWZmCiAgVXBwZXIg4oeQIExvd2Vy4oG8Cn0KaHcg4oaQIDzLmCAy4oC/4oiYIOKliiAiaGVsbG93b3JsZCIKaHcgY2FzZS5VcHBlcuKMvijiipHCqCnihqkgICMgU2V0cyBuZXcgdmFsdWUgZm9yIGh3Cmh3IOKGqSDiiL4g4qWK4o2JIFtodywgIiwgIuKAvyIhIl0Kc3Ag4oaQICcgJz1odwpndiDihpAgKDEtc3ApIOKlisKoIGh3CmdzIOKGkCBzcCDiiKggwrviirg9IGh3CuKIvsKoIGd2IOKKlMucIMK3K2Bncw==">↗️</a><pre> <span class='Function'>∾</span><span class='Modifier'>¨</span> <span class='Value'>gv</span> <span class='Function'>⊔</span><span class='Modifier'>˜</span> <span class='Nothing'>·</span><span class='Function'>+</span><span class='Modifier'>`</span><span class='Value'>gs</span>
⟨ "Hel" "lo," "World!" ⟩
</pre>
<p>In this expression, <a href="expression.html#nothing">Nothing</a> can be removed without changing the meaning. It's used in the train to force <code><span class='Function'>+</span><span class='Modifier'>`</span></code> to apply to <code><span class='Function'>GS</span></code> as a 2-train instead of also taking <code><span class='Function'>⊔</span><span class='Modifier'>˜</span></code> as a left argument. The <a href="scan.html">Scan</a> <code><span class='Function'>+</span><span class='Modifier'>`</span></code> is a prefix sum, progressively adding up the numbers in <code><span class='Value'>gs</span></code>.</p>
-<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=Z3Mg4oaQIHNwIOKIqCDCu+KKuD0gaHcKZ3MKCitgZ3M=">↗️</a><pre> <span class='Value'>gs</span>
+<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=Y2FzZSDihpAgewogIGRpZmYg4oaQIC3CtCAiQWEiCiAgTG93ZXIg4oeQIC3in5xkaWZmCiAgVXBwZXIg4oeQIExvd2Vy4oG8Cn0KaHcg4oaQIDzLmCAy4oC/4oiYIOKliiAiaGVsbG93b3JsZCIKaHcgY2FzZS5VcHBlcuKMvijiipHCqCnihqkgICMgU2V0cyBuZXcgdmFsdWUgZm9yIGh3Cmh3IOKGqSDiiL4g4qWK4o2JIFtodywgIiwgIuKAvyIhIl0Kc3Ag4oaQICcgJz1odwpncyDihpAgc3Ag4oioIMK74oq4PSBodwpncwoKK2Bncw==">↗️</a><pre> <span class='Value'>gs</span>
⟨ 0 0 0 1 0 0 1 0 0 0 0 0 0 ⟩
<span class='Function'>+</span><span class='Modifier'>`</span><span class='Value'>gs</span>
⟨ 0 0 0 1 1 1 2 2 2 2 2 2 2 ⟩
</pre>
<p>The next bit uses <a href="swap.html">Swap</a> to switch the order: <code><span class='Value'>gv</span> <span class='Function'>⊔</span><span class='Modifier'>˜</span> <span class='Function'>+</span><span class='Modifier'>`</span><span class='Value'>gs</span></code> is <code><span class='Paren'>(</span><span class='Function'>+</span><span class='Modifier'>`</span><span class='Value'>gs</span><span class='Paren'>)</span> <span class='Function'>⊔</span> <span class='Value'>gv</span></code>, but sometimes the different order can read better (here it was mostly to squeeze Nothing into the program, I'll admit). <a href="group.html">Group</a> then splits <code><span class='Value'>gv</span></code> up based on the indices given: the first three elements become element 0 of the result, the next three element 1, and the rest element 2.</p>
-<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=Z3Yg4oaQICgxLXNwKSDipYrCqCBodwpncyDihpAgc3Ag4oioIMK74oq4PSBodwooK2Bncykg4oqUIGd2">↗️</a><pre> <span class='Paren'>(</span><span class='Function'>+</span><span class='Modifier'>`</span><span class='Value'>gs</span><span class='Paren'>)</span> <span class='Function'>⊔</span> <span class='Value'>gv</span>
+<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=Y2FzZSDihpAgewogIGRpZmYg4oaQIC3CtCAiQWEiCiAgTG93ZXIg4oeQIC3in5xkaWZmCiAgVXBwZXIg4oeQIExvd2Vy4oG8Cn0KaHcg4oaQIDzLmCAy4oC/4oiYIOKliiAiaGVsbG93b3JsZCIKaHcgY2FzZS5VcHBlcuKMvijiipHCqCnihqkgICMgU2V0cyBuZXcgdmFsdWUgZm9yIGh3Cmh3IOKGqSDiiL4g4qWK4o2JIFtodywgIiwgIuKAvyIhIl0Kc3Ag4oaQICcgJz1odwpndiDihpAgKDEtc3ApIOKlisKoIGh3CmdzIOKGkCBzcCDiiKggwrviirg9IGh3CigrYGdzKSDiipQgZ3Y=">↗️</a><pre> <span class='Paren'>(</span><span class='Function'>+</span><span class='Modifier'>`</span><span class='Value'>gs</span><span class='Paren'>)</span> <span class='Function'>⊔</span> <span class='Value'>gv</span>
┌─
· ⟨ "H" "e" "l" ⟩ ⟨ "l" "o" "," ⟩ ⟨ ⟨⟩ "W" "o" "r" "l" "d" "!" ⟩
diff --git a/docs/tutorial/variable.html b/docs/tutorial/variable.html
index 5e05d336..9314a878 100644
--- a/docs/tutorial/variable.html
+++ b/docs/tutorial/variable.html
@@ -24,11 +24,11 @@
⟨ 3 7 ⟩
</pre>
<p>A variable can't be defined twice in the same <em>scope</em>. Later we'll work with functions and other pieces of code that create their own scopes, but for now all you need to know is that all the code in a tutorial runs in the same scope. So <code><span class='Value'>three</span></code> is already defined, and can't be defined again.</p>
-<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=dGhyZWUg4ouIIHRlbiAtIHRocmVlIOKGkCAzCnRocmVlIOKGkCA0">↗️</a><pre> <span class='Value'>three</span> <span class='Gets'>←</span> <span class='Number'>4</span>
+<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=cGnigL9l4oC/dGVuIOKGkCDin6ggz4AsIOKLhjEsIDEwIOKfqQp0aHJlZSDii4ggdGVuIC0gdGhyZWUg4oaQIDMKdGhyZWUg4oaQIDQ=">↗️</a><pre> <span class='Value'>three</span> <span class='Gets'>←</span> <span class='Number'>4</span>
<span class='Error'>Error: Redefinition</span>
</pre>
<p>It's a little crazy to call them variables if the definition can never change, right? Doesn't &quot;variable&quot; <em>mean</em> &quot;able to change&quot;? Fortunately, this is one way in which BQN isn't crazy. You can <em>modify</em> a variable's value with the arrow <code><span class='Gets'>↩</span></code> provided it's already been defined. This never does anything to the original value: that value stays the same; it's just (probably) not the value of the modified variable any more.</p>
-<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=dGhyZWUg4ouIIHRlbiAtIHRocmVlIOKGkCAzCnRocmVlIOKGkCA0CnRocmVlIOKGqSA0Cgp0aHJlZSA9IDMgICAjIFdhaXQgd2h5IGRpZCBJIGRvIHRoYXQKCjMgPSB0aHJlZSDihqkgMwoKZm91ciDihqkgMyAgICAjIGZvdXIgaXNuJ3QgZGVmaW5lZCB5ZXQ=">↗️</a><pre> <span class='Value'>three</span> <span class='Gets'>↩</span> <span class='Number'>4</span>
+<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=cGnigL9l4oC/dGVuIOKGkCDin6ggz4AsIOKLhjEsIDEwIOKfqQp0aHJlZSDii4ggdGVuIC0gdGhyZWUg4oaQIDMKdGhyZWUg4oaQIDQKdGhyZWUg4oapIDQKCnRocmVlID0gMyAgICMgV2FpdCB3aHkgZGlkIEkgZG8gdGhhdAoKMyA9IHRocmVlIOKGqSAzCgpmb3VyIOKGqSAzICAgICMgZm91ciBpc24ndCBkZWZpbmVkIHlldA==">↗️</a><pre> <span class='Value'>three</span> <span class='Gets'>↩</span> <span class='Number'>4</span>
<span class='Value'>three</span> <span class='Function'>=</span> <span class='Number'>3</span> <span class='Comment'># Wait why did I do that
</span>0
@@ -46,7 +46,7 @@
</pre>
<p>Does BQN not know about capital letters? Does it object to self-reference? Why is &quot;<code><span class='Function'>BQN</span></code>&quot; green? At least there's an error message, and a &quot;role&quot; is something we've heard about before. <em>Assignment</em> means anything written with a leftward arrow—either definition or modification.</p>
<p>I'll first confuse you a little more by pointing out that BQN's variables are case-insensitive, and even underscore-insensitive!</p>
-<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=dGhyZWUg4ouIIHRlbiAtIHRocmVlIOKGkCAzCnRocmVlIOKGkCA0CnRocmVlIOKGqSA0CjMgPSB0aHJlZSDihqkgMwp0aHJlZQp0aHJFZQpUaFJlRQp0aHJfRUUKX190aHJlZQpfVF9IX1JfRV9FXw==">↗️</a><pre> <span class='Value'>three</span>
+<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=cGnigL9l4oC/dGVuIOKGkCDin6ggz4AsIOKLhjEsIDEwIOKfqQp0aHJlZSDii4ggdGVuIC0gdGhyZWUg4oaQIDMKdGhyZWUg4oaQIDQKdGhyZWUg4oapIDQKMyA9IHRocmVlIOKGqSAzCnRocmVlCnRockVlClRoUmVFCnRocl9FRQpfX3RocmVlCl9UX0hfUl9FX0Vf">↗️</a><pre> <span class='Value'>three</span>
3
<span class='Value'>thrEe</span>
3
@@ -60,7 +60,7 @@
3
</pre>
<p>But the syntax highlighter still seems to care, and you'll get a strange result if you try to apply a function to one of the uppercase spellings:</p>
-<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=dGhyZWUg4ouIIHRlbiAtIHRocmVlIOKGkCAzCnRocmVlIOKGkCA0CnRocmVlIOKGqSA0CjMgPSB0aHJlZSDihqkgMwotIFRocmVlCgotIF90aHJlZQ==">↗️</a><pre> <span class='Function'>-</span> <span class='Function'>Three</span>
+<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=cGnigL9l4oC/dGVuIOKGkCDin6ggz4AsIOKLhjEsIDEwIOKfqQp0aHJlZSDii4ggdGVuIC0gdGhyZWUg4oaQIDMKdGhyZWUg4oaQIDQKdGhyZWUg4oapIDQKMyA9IHRocmVlIOKGqSAzCi0gVGhyZWUKCi0gX3RocmVl">↗️</a><pre> <span class='Function'>-</span> <span class='Function'>Three</span>
-3{𝔽}
<span class='Function'>-</span> <span class='Modifier'>_three</span>
diff --git a/md.bqn b/md.bqn
index 63a63d6d..8d8652f5 100644
--- a/md.bqn
+++ b/md.bqn
@@ -203,13 +203,20 @@ Markdown ← {filename𝕊𝕩:
# Function to build REPL link
# May include previous statements to define variables
makeLink ← {
- lines ← names ← nline ← ⟨⟩
- { used‿assigned‿aline 𝕊 ls:
- prev ← lines ⊏˜ ⍷∧ (names ∊ used) / nline
- names ∾↩ assigned
- nline ∾↩ (≠lines) + aline
+ lines ← names ← deps ← ⟨⟩
+ { ns‿assigned‿line 𝕊 𝕩:
+ M ← ⍷∘∧∘∾ # Merge
+ n ← ≠ ls ← 𝕩 ⊏˜ ⍷line # Lines with variables
+ lc ← (≠lines) + ↕n # Indices they'll have
lines ∾↩ ls
- JoinLines prev ∾ 𝕩
+ JoinLines 𝕩 ∾˜ lines ⊏˜ (-n) ↓ M lc { l𝕊[n,a]:
+ e ← (≠names) > i ← names ⊐ n # Look up the names
+ d ← l ∾˜ M (e/i) ⊏ deps # Dependencies for this line
+ deps M⟜d¨⌾(((a∧e)/i)⊸⊏)↩ # Add these to reassigned names
+ names ∾↩ new ← (a∧¬e) / n # Add new names
+ deps ∾↩ d¨ new # With this line's dependencies
+ d
+ }⟜⍉¨ (⊐line) ⊔ ns≍˘assigned
}
}
@@ -249,20 +256,23 @@ Markdown ← {filename𝕊𝕩:
# Link that runs the code
# Parse assignments and variables to add previous lines if needed
+ # First locate the names
In ← 1=+⟜(↕2)⊸⍋
- Names ← (((-´"aA")×"AZ"⊸In)⊸+code) ⊔˜ 1-˜('_'≠code)⊸×
ma‿sp‿st ← {m∧code=𝕩}¨"↩ ‿" ⋄ id←sp<sid
- unames ← ("az"In⊑¨)⊸/ Names id×+`»⊸<id # Used names
- fma ← ma PG⌾⌽ ¬sp∨ma # Assume anything before ↩ with no space is modified assignment
- ea ← top ∧ »⊸< a ∨ fma # Character after assignment target
+ idInd ← / word ← »⊸<id # Starts of words
+ lc ← ((-´"aA")×"AZ"In⊢)⊸+ code # Lowercase code
+ names ← lc ⊔˜ 1 -˜ (id∧'_'≠code) × +`word # Used names
+ names‿idInd ("az"In⊑¨names)⊸/¨↩ # Filter out numbers
+ names (∧`'.'⊸≠)⊸/¨↩
+ iline ← idInd ⊏ +`break # Line number
+ # Find the top-level assignments
+ fma ← ma PG⌾⌽ ¬sp∨ma # Assume anything before ↩ with no space is modified assignment
+ ea ← top ∧ »⊸< a ∨ fma # Character after assignment target
cont ← sp ∨ (»⊸∧ id) ∨ (»⊸∨ st PG sp) ∨ » 0<depth
- target ← id ∧ « ea PG⌾⌽ cont # Top-level assignment targets
- tnum ← +` »⊸< target # Number of assignments so far
- anames ← Names target×tnum # Assigned names
- ai ← {+`⁼(𝕩-1)⊏tnum}⊸/ /ea # Indices where assigned
- aline ← ai ⊏ +`break # Line number
+ target ← « ea PG⌾⌽ cont # Top-level assignment targets
+ ia ← idInd ⊏ target # Whether each name is assigned
# Build the link element
- lu ← tryURL ∾ Base64 ¯1 ↓ unames‿anames‿aline MakeLink parts
+ lu ← tryURL ∾ Base64 ¯1 ↓ names‿ia‿iline MakeLink parts
l ← "a class=""replLink"" title=""Open in the REPL"" target=""_blank"" href="
link ← (l∾""""(∾∾⊣)lu) Html "↗️"
⟨r, /break, link⟩