aboutsummaryrefslogtreecommitdiff
path: root/docs/doc/enclose.html
diff options
context:
space:
mode:
Diffstat (limited to 'docs/doc/enclose.html')
-rw-r--r--docs/doc/enclose.html7
1 files changed, 4 insertions, 3 deletions
diff --git a/docs/doc/enclose.html b/docs/doc/enclose.html
index 2a401603..82fbee31 100644
--- a/docs/doc/enclose.html
+++ b/docs/doc/enclose.html
@@ -37,9 +37,10 @@
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=K8udy5ggM+KAvzTipYrihpUxMg==">↗️</a><pre> <span class='Function'>+</span><span class='Modifier'>˝˘</span> <span class='Number'>3</span><span class='Ligature'>‿</span><span class='Number'>4</span><span class='Function'>⥊↕</span><span class='Number'>12</span>
⟨ 6 22 38 ⟩
</pre>
-<p>In this case each call to <code><span class='Function'>+</span><span class='Modifier'>˝</span></code> returns a cell of the result. The result is a list, so its cells are units! Here, Cells (<code><span class='Modifier'>˘</span></code>) &quot;hides&quot; one axis from its operand, and the operand <code><span class='Function'>+</span><span class='Modifier'>˝</span></code> reduces out an axis, leaving zero axes—until Cells assembles the results, putting its axis back. In this case, <code><span class='Function'>+</span><span class='Modifier'>´</span></code> would also be tolerated. But it's wrong, because each result really should be a zero-axis array. We can reveal this by making an array whose elements aren't atoms.</p>
-<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=K8K0y5gg4p+o4oaVMiwiYWIi4p+p4omN4p+o4oaVMywiQUJDIuKfqQory53LmCDin6jihpUyLCJhYiLin6niiY3in6jihpUzLCJBQkMi4p+p">↗️</a><pre> <span class='Function'>+</span><span class='Modifier'>´˘</span> <span class='Bracket'>⟨</span><span class='Function'>↕</span><span class='Number'>2</span><span class='Separator'>,</span><span class='String'>&quot;ab&quot;</span><span class='Bracket'>⟩</span><span class='Function'>≍</span><span class='Bracket'>⟨</span><span class='Function'>↕</span><span class='Number'>3</span><span class='Separator'>,</span><span class='String'>&quot;ABC&quot;</span><span class='Bracket'>⟩</span>
+<p>In this case each call to <code><span class='Function'>+</span><span class='Modifier'>˝</span></code> returns a cell of the result. The result is a list, so its cells are units! Here, <a href="rank.html">Cells</a> (<code><span class='Modifier'>˘</span></code>) &quot;hides&quot; one axis from its operand, and the operand <code><span class='Function'>+</span><span class='Modifier'>˝</span></code> reduces out an axis, leaving zero axes—until Cells assembles the results, putting its axis back. In this case, <code><span class='Function'>+</span><span class='Modifier'>´</span></code> would also be tolerated. But it's wrong, because each result really should be a zero-axis array. We can reveal this by making an array whose elements aren't atoms.</p>
+<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=K8K0y5gg4p+o4oaVMiwiYWIi4p+p4omN4p+o4oaVMywiQUJDIuKfqQoKK8udy5gg4p+o4oaVMiwiYWIi4p+p4omN4p+o4oaVMywiQUJDIuKfqQ==">↗️</a><pre> <span class='Function'>+</span><span class='Modifier'>´˘</span> <span class='Bracket'>⟨</span><span class='Function'>↕</span><span class='Number'>2</span><span class='Separator'>,</span><span class='String'>&quot;ab&quot;</span><span class='Bracket'>⟩</span><span class='Function'>≍</span><span class='Bracket'>⟨</span><span class='Function'>↕</span><span class='Number'>3</span><span class='Separator'>,</span><span class='String'>&quot;ABC&quot;</span><span class='Bracket'>⟩</span>
<span class='Error'>Error: >: Elements didn't have equal shapes (contained ⟨2⟩ and ⟨3⟩)</span>
+
<span class='Function'>+</span><span class='Modifier'>˝˘</span> <span class='Bracket'>⟨</span><span class='Function'>↕</span><span class='Number'>2</span><span class='Separator'>,</span><span class='String'>&quot;ab&quot;</span><span class='Bracket'>⟩</span><span class='Function'>≍</span><span class='Bracket'>⟨</span><span class='Function'>↕</span><span class='Number'>3</span><span class='Separator'>,</span><span class='String'>&quot;ABC&quot;</span><span class='Bracket'>⟩</span>
⟨ "ac" "ACE" ⟩
</pre>
@@ -76,7 +77,7 @@
0 0 0 1 3
</pre>
-<p>Now Cells (<code><span class='Modifier'>˘</span></code>) splits both arguments into cells. For the <code><span class='Value'>𝕨</span></code>, a rank-2 array, these cells are lists; for the list <code><span class='Value'>𝕩</span></code> they have to be units. Treating them as elements would work in this case, because <code><span class='Function'>∾</span></code> would automatically enclose them, but would fail if <code><span class='Value'>𝕩</span></code> contained non-atom elements such as strings.</p>
+<p>Now <a href="rank.html">Cells</a> (<code><span class='Modifier'>˘</span></code>) splits both arguments into cells. For the <code><span class='Value'>𝕨</span></code>, a rank-2 array, these cells are lists; for the list <code><span class='Value'>𝕩</span></code> they have to be units. Treating them as elements would work in this case, because <code><span class='Function'>∾</span></code> would automatically enclose them, but would fail if <code><span class='Value'>𝕩</span></code> contained non-atom elements such as strings.</p>
<p>The other use of <code><span class='Function'>&lt;</span></code> in the original example is <code><span class='Paren'>(</span><span class='Function'>&lt;</span><span class='Bracket'>⟨⟩</span><span class='Paren'>)</span></code>, which is the left argument to the function <code><span class='Function'>&lt;</span><span class='Modifier2'>⊸</span><span class='Function'>∾</span><span class='Modifier'>⌜´</span></code>. Let's break that function down. We said <code><span class='Function'>&lt;</span><span class='Modifier2'>⊸</span><span class='Function'>∾</span></code> joins <code><span class='Value'>𝕨</span></code> as an element to the front of <code><span class='Value'>𝕩</span></code>. With <a href="map.html#table">Table</a> we have <code><span class='Function'>&lt;</span><span class='Modifier2'>⊸</span><span class='Function'>∾</span><span class='Modifier'>⌜</span></code>, which takes two array arguments and does this for every pair of elements from them.</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=InJlZCLigL8iYmx1ZSLigL8iZ3JlZW4iIDziirjiiL7ijJwg4p+oInVwIuKfqeKAv+KfqCJkb3duIuKfqQ==">↗️</a><pre> <span class='String'>&quot;red&quot;</span><span class='Ligature'>‿</span><span class='String'>&quot;blue&quot;</span><span class='Ligature'>‿</span><span class='String'>&quot;green&quot;</span> <span class='Function'>&lt;</span><span class='Modifier2'>⊸</span><span class='Function'>∾</span><span class='Modifier'>⌜</span> <span class='Bracket'>⟨</span><span class='String'>&quot;up&quot;</span><span class='Bracket'>⟩</span><span class='Ligature'>‿</span><span class='Bracket'>⟨</span><span class='String'>&quot;down&quot;</span><span class='Bracket'>⟩</span>
┌─