aboutsummaryrefslogtreecommitdiff
path: root/docs/doc
diff options
context:
space:
mode:
Diffstat (limited to 'docs/doc')
-rw-r--r--docs/doc/leading.html2
-rw-r--r--docs/doc/primitive.html2
-rw-r--r--docs/doc/scan.html4
-rw-r--r--docs/doc/search.html12
-rw-r--r--docs/doc/select.html9
-rw-r--r--docs/doc/selfcmp.html45
-rw-r--r--docs/doc/shape.html6
7 files changed, 39 insertions, 41 deletions
diff --git a/docs/doc/leading.html b/docs/doc/leading.html
index 9b3b408d..b3b008c8 100644
--- a/docs/doc/leading.html
+++ b/docs/doc/leading.html
@@ -8,7 +8,7 @@
<p>Several primitive functions manipulate the right argument, or sometimes both arguments, of an <a href="array.html">array</a> along one or more axes. According to the <a href="https://aplwiki.com/wiki/Leading_axis_theory">leading axis model</a>, it's best to make the primitives operate on initial axes, because the <a href="rank.html">Rank modifier</a> then allows it to apply to later axes as well. Here we'll see how this pattern works in BQN.</p>
<h2 id="monadic-functions"><a class="header" href="#monadic-functions">Monadic functions</a></h2>
<h3 id="manipulating-cells"><a class="header" href="#manipulating-cells">Manipulating cells</a></h3>
-<p>Most monadic functions that deal with structure at all (that is, not arithmetic) work only on the first axis of the argument. Usually, they treat it as a list of its <a href="array.html#cells">major cells</a>. The function <a href="shape.html">Length</a> (<code><span class='Function'>≠</span></code>) counts these major cells, while <a href="prefixes.html">Prefixes</a> (<code><span class='Function'>↑</span></code>), Suffixes (<code><span class='Function'>↓</span></code>), <a href="reverse.html">Reverse</a> (<code><span class='Function'>⌽</span></code>), and <a href="select.html">First Cell</a> (<code><span class='Function'>⊏</span></code>) move them around. The <a href="fold.html#insert">Insert</a> (<code><span class='Modifier'>˝</span></code>) and <a href="scan.html">Scan</a> (<code><span class='Modifier'>`</span></code>) modifiers also yield functions that work along the first axis; <a href="fold.html">Fold</a> (<code><span class='Modifier'>´</span></code>) requires <code><span class='Value'>𝕩</span></code> to be a list but does go along the first (only) axis of that list.</p>
+<p>Most monadic functions that deal with structure at all (that is, not arithmetic) work only on the first axis of the argument. Usually, they treat it as a list of its <a href="array.html#cells">major cells</a>. The function <a href="shape.html">Length</a> (<code><span class='Function'>≠</span></code>) counts these major cells, while <a href="prefixes.html">Prefixes</a> (<code><span class='Function'>↑</span></code>), Suffixes (<code><span class='Function'>↓</span></code>), <a href="reverse.html">Reverse</a> (<code><span class='Function'>⌽</span></code>), and <a href="select.html#first-cell">First Cell</a> (<code><span class='Function'>⊏</span></code>) move them around. The <a href="fold.html#insert">Insert</a> (<code><span class='Modifier'>˝</span></code>) and <a href="scan.html">Scan</a> (<code><span class='Modifier'>`</span></code>) modifiers also yield functions that work along the first axis; <a href="fold.html">Fold</a> (<code><span class='Modifier'>´</span></code>) requires <code><span class='Value'>𝕩</span></code> to be a list but does go along the first (only) axis of that list.</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=4oqiIGEg4oaQIDPigL8yIOKliiAiYWJjZGVmIiAgIyBBbiBhcnJheSB3aXRoIHRocmVlIG1ham9yIGNlbGxzCgriio8gYSAgICAgICAgICAgICAgICAgICAjIEdldCB0aGUgZmlyc3QgbWFqb3IgY2VsbAoK4oy9IGEgICAgICAgICAgICAgICAgICAgIyBSZXZlcnNlIHRoZSBjZWxscwoK4oqjYCBhICAgICAgICAgICAgICAgICAgIyBSZXBsaWNhdGUgdGhlIGZpcnN0IGNlbGw=">↗️</a><pre> <span class='Function'>⊢</span> <span class='Value'>a</span> <span class='Gets'>←</span> <span class='Number'>3</span><span class='Ligature'>‿</span><span class='Number'>2</span> <span class='Function'>⥊</span> <span class='String'>&quot;abcdef&quot;</span> <span class='Comment'># An array with three major cells
</span>┌─
╵"ab
diff --git a/docs/doc/primitive.html b/docs/doc/primitive.html
index a981ae81..98ec74aa 100644
--- a/docs/doc/primitive.html
+++ b/docs/doc/primitive.html
@@ -201,7 +201,7 @@
</tr>
<tr>
<td><code><span class='Function'>⊏</span></code></td>
-<td><a href="select.html">First Cell</a></td>
+<td><a href="select.html#first-cell">First Cell</a></td>
<td><a href="select.html">Select</a></td>
</tr>
<tr>
diff --git a/docs/doc/scan.html b/docs/doc/scan.html
index c975e35c..bac2f4c5 100644
--- a/docs/doc/scan.html
+++ b/docs/doc/scan.html
@@ -58,7 +58,7 @@
</g>
</svg>
-<p>The 1-modifier Scan (<code><span class='Modifier'>`</span></code>) moves along the first axis of the array <code><span class='Value'>𝕩</span></code>, building up an array of results by applying <code><span class='Function'>𝔽</span></code> repeatedly beginning with <code><span class='Value'>𝕨</span></code> or <code><span class='Function'>⊏</span><span class='Value'>𝕩</span></code>. It's related to the fold modifiers, and most closely resembles the <a href="fold.html#apl2-reduction">APL2-style reduction</a> <code><span class='Modifier'>¨˝</span></code>, but it traverses the array in forward rather than reverse index order, and includes all intermediate results of <code><span class='Function'>𝔽</span></code> in its output instead of just the final one.</p>
+<p>The 1-modifier Scan (<code><span class='Modifier'>`</span></code>) moves along the first axis of the array <code><span class='Value'>𝕩</span></code>, building up an array of results by applying <code><span class='Function'>𝔽</span></code> repeatedly beginning with <code><span class='Value'>𝕨</span></code> or <code><span class='Function'>⊏</span><span class='Value'>𝕩</span></code>. It's related to the <a href="fold.html">fold</a> modifiers, and most closely resembles the <a href="fold.html#apl2-reduction">APL2-style reduction</a> <code><span class='Modifier'>¨˝</span></code>, but it traverses the array in forward rather than reverse index order, and includes all intermediate results of <code><span class='Function'>𝔽</span></code> in its output instead of just the final one.</p>
<p>BQN's Scan is ordered differently from Scan in APL. Both include one result for each non-empty prefix of <code><span class='Value'>𝕩</span></code>. In BQN this is a left-to-right fold, so that each new result requires one application of <code><span class='Function'>𝔽</span></code>. APL uses right-to-left folds, which matches with reduction, but requires starting over at the end for each new prefix, except in special cases. If needed, this definition can be obtained with a fold on each <a href="prefixes.html">prefix</a> except the first (which is empty). In the particular case of <code><span class='Function'>-</span><span class='Value'>⍀</span></code>, that nested solution isn't needed: negate odd-indexed elements and then apply <code><span class='Function'>+</span><span class='Modifier'>`</span></code>.</p>
<p>Scan also differs from Fold or Insert in that it never depends on <code><span class='Function'>𝔽</span></code>'s <a href="fold.html#identity-values">identity value</a>, because scanning over an empty array simply returns that array.</p>
<h2 id="lists"><a class="header" href="#lists">Lists</a></h2>
@@ -142,7 +142,7 @@
¯2 0.25 'a' ∞
</pre>
-<p>If <code><span class='Value'>𝕨</span></code> is given, it must have the same shape as a major cell of <code><span class='Value'>𝕩</span></code> (this is why <code><span class='Value'>𝕨</span></code> needs to be enclosed when <code><span class='Value'>𝕩</span></code> is a list: in general it's an array). Then the first result cell is found by applying <code><span class='Function'>𝔽</span></code> to elements of <code><span class='Value'>𝕨</span></code> and <code><span class='Function'>⊏</span><span class='Value'>𝕩</span></code>, and the computation continues as in the one-argument case for remaining cells.</p>
+<p>If <code><span class='Value'>𝕨</span></code> is given, it must have the same shape as a <a href="array.html#cells">major cell</a> of <code><span class='Value'>𝕩</span></code> (this is why <code><span class='Value'>𝕨</span></code> needs to be enclosed when <code><span class='Value'>𝕩</span></code> is a list: in general it's an array). Then the first result cell is found by applying <code><span class='Function'>𝔽</span></code> to elements of <code><span class='Value'>𝕨</span></code> and <code><span class='Function'>⊏</span><span class='Value'>𝕩</span></code>, and the computation continues as in the one-argument case for remaining cells.</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=M+KAvzLigL8x4oC/MCArYCBh">↗️</a><pre> <span class='Number'>3</span><span class='Ligature'>‿</span><span class='Number'>2</span><span class='Ligature'>‿</span><span class='Number'>1</span><span class='Ligature'>‿</span><span class='Number'>0</span> <span class='Function'>+</span><span class='Modifier'>`</span> <span class='Value'>a</span>
┌─
╵ 1 2.25 'b' ∞
diff --git a/docs/doc/search.html b/docs/doc/search.html
index 2e75dc97..a92b25c1 100644
--- a/docs/doc/search.html
+++ b/docs/doc/search.html
@@ -89,7 +89,7 @@
</g>
</svg>
-<p>The three search functions are Index of (<code><span class='Function'>⊐</span></code>), Progressive Index of (<code><span class='Function'>⊒</span></code>), and Member of (<code><span class='Function'>∊</span></code>). These are dyadic functions that search one argument (&quot;searched-in&quot;) for major cells <a href="match.html">matching</a> cells from the other (&quot;searched-for&quot;). For example, Index of returns, for each cell in <code><span class='Value'>𝕩</span></code>, the index of the first cell in <code><span class='Value'>𝕨</span></code> that matches it.</p>
+<p>The three search functions are Index of (<code><span class='Function'>⊐</span></code>), Progressive Index of (<code><span class='Function'>⊒</span></code>), and Member of (<code><span class='Function'>∊</span></code>). These are dyadic functions that search one argument (&quot;searched-in&quot;) for major cells <a href="match.html">matching</a> cells from the other (&quot;searched-for&quot;). For example, Index of returns, for each <a href="array.html#cells">cell</a> in <code><span class='Value'>𝕩</span></code>, the index of the first cell in <code><span class='Value'>𝕨</span></code> that matches it.</p>
<table>
<thead>
<tr>
@@ -153,7 +153,7 @@
⟨ 1 4 2 ⟩
</pre>
<p><code><span class='Value'>𝕩</span><span class='Function'>∊</span><span class='Value'>𝕨</span></code> is the same as <code><span class='Paren'>(</span><span class='Value'>𝕨</span><span class='Function'>⊐</span><span class='Value'>𝕩</span><span class='Paren'>)</span><span class='Function'>&lt;≠</span><span class='Value'>𝕨</span></code>. Note the reversal of arguments! In both <code><span class='Function'>∊</span></code> and <code><span class='Function'>⊐</span></code>, the open side points to the searched-in argument and the closed side points to the searched-for argument. Relatedly, in Select (<code><span class='Function'>⊏</span></code>), the open side points to the selected argument, which is more like the searched-in argument in that its cells are generally accessed out of order (the searched-for argument is most like the selection result <code><span class='Value'>𝕨</span><span class='Function'>⊏</span><span class='Value'>𝕩</span></code>).</p>
-<p>Index of always returns exactly one number, even if there are multiple matches, or no matches at all. To find the indices of all matches, start with <a href="match.html">Match</a> <a href="map.html">Each</a>, then <a href="replicate.html#indices">Indices</a> (I didn't mean for it to sound so repetitive! It just happened!).</p>
+<p>Index of always returns exactly one number, even if there are multiple matches, or no matches at all. To find the indices of all matches, start with <a href="match.html">Match</a> <a href="map.html">Each</a>, then apply <a href="replicate.html#indices">Indices</a> (I didn't mean for it to sound so repetitive! It just happened!).</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=LyAibGV0dGVycyIg4omhwqg8ICdlJyAgICAgICAgIyBNYW55IHRvIG9uZQoKImxldHRlcnMiICg84oiYL8uY4omh4oycy5wpICJsZXQiICAjIE1hbnkgdG8gbWFueQ==">↗️</a><pre> <span class='Function'>/</span> <span class='String'>&quot;letters&quot;</span> <span class='Function'>≡</span><span class='Modifier'>¨</span><span class='Function'>&lt;</span> <span class='String'>'e'</span> <span class='Comment'># Many to one
</span>⟨ 1 4 ⟩
@@ -161,7 +161,7 @@
</span>⟨ ⟨ 0 ⟩ ⟨ 1 4 ⟩ ⟨ 2 3 ⟩ ⟩
</pre>
<h2 id="progressive-index-of"><a class="header" href="#progressive-index-of">Progressive Index of</a></h2>
-<p>Progressive Index of (<code><span class='Function'>⊒</span></code>), as the name and glyph suggest, is a more sophisticated variant of Index of. Like Index of, it returns either <code><span class='Function'>≠</span><span class='Value'>𝕨</span></code> or an index of a cell from <code><span class='Value'>𝕨</span></code> that matches the given cell of <code><span class='Value'>𝕩</span></code>. Unlike Index of, no index except <code><span class='Function'>≠</span><span class='Value'>𝕨</span></code> can ever be repeated. Progressive Index of returns the index of the first <em>unused</em> match, provided there's still one left.</p>
+<p>Progressive Index of (<code><span class='Function'>⊒</span></code>), as the name and glyph suggest, is a more sophisticated variant of Index of. Like Index of, it returns either <code><span class='Function'>≠</span><span class='Value'>𝕨</span></code> or an index of a cell from <code><span class='Value'>𝕨</span></code> that matches the given cell of <code><span class='Value'>𝕩</span></code>. Unlike Index of, no index can ever be repeated (but <code><span class='Function'>≠</span><span class='Value'>𝕨</span></code> can). Progressive Index of returns the index of the first <em>unused</em> match, provided there's still one left.</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=ImFhYSIg4oqSICJhYWFhYSIKCiJhYWFiYiIg4oqSICJhYmFiYWJhYmFiIg==">↗️</a><pre> <span class='String'>&quot;aaa&quot;</span> <span class='Function'>⊒</span> <span class='String'>&quot;aaaaa&quot;</span>
⟨ 0 1 2 3 3 ⟩
@@ -209,7 +209,7 @@
· 2
</pre>
-<p>Just as bad, this result has the right information, but is enclosed and could break the program later on. Remember that the result of a search function is <em>always</em> an array. We really want the <a href="pick.html#first">first</a> element.</p>
+<p>This result has the right information, but is enclosed and could break the program later on. Remember that the result of a search function is <em>always</em> an array. We really want the <a href="pick.html#first">first</a> element.</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=c3R1ZmYg4oqR4oiY4oqQ4p+cPCAic3RyaW5nIg==">↗️</a><pre> <span class='Value'>stuff</span> <span class='Function'>⊑</span><span class='Modifier2'>∘</span><span class='Function'>⊐</span><span class='Modifier2'>⟜</span><span class='Function'>&lt;</span> <span class='String'>&quot;string&quot;</span>
2
</pre>
@@ -235,7 +235,7 @@
</pre>
<p>But the searched-in argument doesn't have to be a list either! It can also be an array of higher rank. Rank 0 isn't allowed: if you want to &quot;search&quot; a unit, you're probably just looking for <a href="match.html">match</a>.</p>
-<p>The searched-in argument is treated as a list of its major cells. It's the rank of these major cells—let's call this rank <code><span class='Value'>c</span></code>—that determines how the searched-for argument is treated. That argument must have rank <code><span class='Value'>c</span></code> or more, and it's treated as an array of <code><span class='Value'>c</span></code>-cells. For example, if the left argument to <code><span class='Function'>⊐</span></code> is a rank-2 table, then each 1-cell (row) of <code><span class='Value'>𝕩</span></code> is searched for independently, yielding one number in the result: a 0-cell.</p>
+<p>The searched-in argument is treated as a list of its <a href="array.html#cells">major cells</a>. It's the rank of these major cells—let's call this rank <code><span class='Value'>c</span></code>—that determines how the searched-for argument is treated. That argument must have rank <code><span class='Value'>c</span></code> or more, and it's treated as an array of <code><span class='Value'>c</span></code>-cells. For example, if the left argument to <code><span class='Function'>⊐</span></code> is a rank-2 table, then each 1-cell (row) of <code><span class='Value'>𝕩</span></code> is searched for independently, yielding one number in the result: a 0-cell.</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=4oqiIHJvd3Mg4oaQID4icm93IuKAvyJyaG8i4oC/InJvdyLigL8icnVlIgoKcm93cyDiipAgPiJyb3ci4oC/InJvdyLigL8iY29sIuKJjSJyaG8i4oC/ImNvdyLigL8iY29sIg==">↗️</a><pre> <span class='Function'>⊢</span> <span class='Value'>rows</span> <span class='Gets'>←</span> <span class='Function'>&gt;</span><span class='String'>&quot;row&quot;</span><span class='Ligature'>‿</span><span class='String'>&quot;rho&quot;</span><span class='Ligature'>‿</span><span class='String'>&quot;row&quot;</span><span class='Ligature'>‿</span><span class='String'>&quot;rue&quot;</span>
┌─
╵"row
@@ -251,7 +251,7 @@
</pre>
<p>So the result rank of <code><span class='Function'>⊐</span></code> is always <code><span class='Value'>𝕨</span><span class='Function'>¬</span><span class='Modifier2'>○</span><span class='Function'>=</span><span class='Value'>𝕩</span></code>, with a result shape <code><span class='Paren'>(</span><span class='Number'>1</span><span class='Function'>-</span><span class='Modifier'>˜</span><span class='Function'>=</span><span class='Value'>𝕨</span><span class='Paren'>)</span><span class='Function'>↓≢</span><span class='Value'>𝕩</span></code>, and <code><span class='Value'>𝕨</span><span class='Function'>⊐</span><span class='Value'>𝕩</span></code> fails if <code><span class='Number'>1</span><span class='Function'>&gt;=</span><span class='Value'>𝕩</span></code> or the result rank would be negative. In the list case, we have <code><span class='Number'>1</span><span class='Function'>==</span><span class='Value'>𝕩</span></code> (so the first condition holds), and the result rank resolves to <code><span class='Function'>=</span><span class='Value'>𝕨</span></code> (which can't be negative, so the second holds as well). The cell rank of <code><span class='Value'>𝕩</span></code> is 0, and the fact that a 0-cell of <code><span class='Value'>𝕩</span></code> gives a 0-cell of the result is what causes the shape arithmetic to be so simple.</p>
-<p>For Member of, the arguments are reversed relative to Index of, but otherwise everything's the same. This differs from APL, where entries are always elements, not cells. Many APL designers consider the APL definition to be a failure of foresight and would prefer BQN's definition—or rather A+'s or J's definition, as these languages were actually the first to use it. The rank-aware version is more flexible, as it allows both searching for elements and searching for rows. APL would return the first result in both cases.</p>
+<p>For Member of, the arguments are reversed relative to Index of, but otherwise everything's the same. This differs from APL, where entries are always elements, not cells. Many APL designers consider the APL definition to be a failure of foresight and would prefer BQN's definition—or rather A+'s or J's definition, as these languages were actually the first to use it. The rank-aware version is more flexible, as it allows both searching for elements and searching for rows. APL would return the first result in both cases below.</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=KDLigL8x4omNM+KAvzEpIOKIiiAz4oC/MeKAvzTigL8zCgooMuKAvzHiiY0z4oC/MSkg4oiKIDPigL8x4omNNOKAvzM=">↗️</a><pre> <span class='Paren'>(</span><span class='Number'>2</span><span class='Ligature'>‿</span><span class='Number'>1</span><span class='Function'>≍</span><span class='Number'>3</span><span class='Ligature'>‿</span><span class='Number'>1</span><span class='Paren'>)</span> <span class='Function'>∊</span> <span class='Number'>3</span><span class='Ligature'>‿</span><span class='Number'>1</span><span class='Ligature'>‿</span><span class='Number'>4</span><span class='Ligature'>‿</span><span class='Number'>3</span>
┌─
╵ 0 1
diff --git a/docs/doc/select.html b/docs/doc/select.html
index aaa36cc3..566f6484 100644
--- a/docs/doc/select.html
+++ b/docs/doc/select.html
@@ -51,7 +51,7 @@
<p>The function Select (<code><span class='Function'>⊏</span></code>) reorganizes the array <code><span class='Value'>𝕩</span></code> along one or more axes based on <a href="indices.html">indices</a> given by <code><span class='Value'>𝕨</span></code>. The result has the same <a href="depth.html">depth</a> as <code><span class='Value'>𝕩</span></code>, since its elements are always elements of <code><span class='Value'>𝕩</span></code>. This means it differs from <a href="pick.html">Pick</a> (<code><span class='Function'>⊑</span></code>), which takes elements from <code><span class='Value'>𝕩</span></code> but can arrange them in any nested structure, including returning an element directly.</p>
<p>The monadic form First Cell (<code><span class='Function'>⊏</span></code>) gets the major cell with index 0, so that <code><span class='Function'>⊏</span><span class='Value'>𝕩</span></code> is identical to <code><span class='Number'>0</span><span class='Function'>⊏</span><span class='Value'>𝕩</span></code>.</p>
<h2 id="single-selection"><a class="header" href="#single-selection">Single selection</a></h2>
-<p>Each axis of a BQN array is numbered starting at zero. Major cells are arranged along the first axis; in accordance with the <a href="leading.html">leading axis</a> principle, Select returns a major cell of <code><span class='Value'>𝕩</span></code> when <code><span class='Value'>𝕨</span></code> is an atom.</p>
+<p>The <a href="array.html#cells">major cells</a> of an array are arranged along the <a href="leading.html">first axis</a> and numbered starting at 0. For a natural number <code><span class='Value'>𝕨</span></code>, Select returns the major cell of <code><span class='Value'>𝕩</span></code> with index <code><span class='Value'>𝕨</span></code>.</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=MiDiio8gImFiY2RlZiIgICMgQW4gZW5jbG9zZWQgZWxlbWVudAoKMiDiipEgImFiY2RlZiIgICMgUGljayBnZXRzIGEgbm9uLWVuY2xvc2VkIGVsZW1lbnQKCjIg4oqPID4ibnVsIuKAvyJvbmUi4oC/InR3byLigL8idHJlIuKAvyJmb3IiCgowIOKKjyA8NSAgIyBObyBmaXJzdCBheGlzIHRvIHNlbGVjdCBmcm9t">↗️</a><pre> <span class='Number'>2</span> <span class='Function'>⊏</span> <span class='String'>&quot;abcdef&quot;</span> <span class='Comment'># An enclosed element
</span>┌·
·'c'
@@ -66,7 +66,7 @@
<span class='Number'>0</span> <span class='Function'>⊏</span> <span class='Function'>&lt;</span><span class='Number'>5</span> <span class='Comment'># No first axis to select from
</span><span class='Error'>Error: ⊏: 𝕩 cannot be a unit</span>
</pre>
-<p>As a major cell of <code><span class='Value'>𝕩</span></code>, the result has rank one less than it and its shape is <code><span class='Number'>1</span><span class='Function'>↓≢</span><span class='Value'>𝕩</span></code>. <code><span class='Value'>𝕩</span></code> must have rank one or more.</p>
+<p>As a major cell, the result has rank one less than <code><span class='Value'>𝕩</span></code> and shape <code><span class='Number'>1</span><span class='Function'>↓≢</span><span class='Value'>𝕩</span></code>. Of course <code><span class='Value'>𝕩</span></code> must have at least one axis to select along, or there are no major cells and you'll get an error.</p>
<p>The index <code><span class='Value'>𝕨</span></code> has to be an integer less than <code><span class='Function'>≠</span><span class='Value'>𝕩</span></code>. It can be negative, in which case it must be greater than or equal to <code><span class='Function'>-≠</span><span class='Value'>𝕩</span></code>. Negative indices select from the end of <code><span class='Value'>𝕩</span></code>, in that <code><span class='Number'>¯1</span></code> indicates the last major cell and <code><span class='Function'>-≠</span><span class='Value'>𝕩</span></code> indicates the first. If <code><span class='Function'>≠</span><span class='Value'>𝕩</span></code> is 0, then no index is valid.</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=wq8yIOKKjyAiYWJjZGVmIgoKMCDiio8gIiI=">↗️</a><pre> <span class='Number'>¯2</span> <span class='Function'>⊏</span> <span class='String'>&quot;abcdef&quot;</span>
┌·
@@ -76,6 +76,7 @@
<span class='Number'>0</span> <span class='Function'>⊏</span> <span class='String'>&quot;&quot;</span>
<span class='Error'>Error: ⊏: Indexing out-of-bounds (𝕨≡0, 0≡≠𝕩)</span>
</pre>
+<h3 id="first-cell"><a class="header" href="#first-cell">First Cell</a></h3>
<p>The monadic case First Cell (<code><span class='Function'>⊏</span><span class='Value'>𝕩</span></code>) is identical to <code><span class='Number'>0</span><span class='Function'>⊏</span><span class='Value'>𝕩</span></code>. It has the same restrictions: <code><span class='Value'>𝕩</span></code> must have rank 1 or more, and length 1 or more.</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=4oqPICJhYmMiCgriio8gImFiYyLiiY0iZGVmIgoK4oqPIOKJjSAiYWJjIgoK4oqPICdhJw==">↗️</a><pre> <span class='Function'>⊏</span> <span class='String'>&quot;abc&quot;</span>
┌·
@@ -92,7 +93,7 @@
<span class='Error'>Error: ⊏: Argument cannot be an atom</span>
</pre>
<h2 id="first-axis-selection"><a class="header" href="#first-axis-selection">First-axis selection</a></h2>
-<p>If <code><span class='Value'>𝕨</span></code> is an array of numbers (including any empty array), then each number indicates a major cell of <code><span class='Value'>𝕩</span></code>. In the simplest case, a list of numbers gives a result with the same rank as <code><span class='Value'>𝕩</span></code> but maybe not the same length.</p>
+<p>If <code><span class='Value'>𝕨</span></code> is an array of numbers (including any empty array), then each number indicates a major cell of <code><span class='Value'>𝕩</span></code>. In the simplest case, a list of numbers gives a result with the same rank as <code><span class='Value'>𝕩</span></code> but the length of <code><span class='Value'>𝕨</span></code>.</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=MuKAvzPigL8z4oC/MOKAvzTigL8xIOKKjyAiT2xaRXQiCgrin6jin6kg4oqPICJPbFpFdCI=">↗️</a><pre> <span class='Number'>2</span><span class='Ligature'>‿</span><span class='Number'>3</span><span class='Ligature'>‿</span><span class='Number'>3</span><span class='Ligature'>‿</span><span class='Number'>0</span><span class='Ligature'>‿</span><span class='Number'>4</span><span class='Ligature'>‿</span><span class='Number'>1</span> <span class='Function'>⊏</span> <span class='String'>&quot;OlZEt&quot;</span>
"ZEEOtl"
@@ -183,4 +184,4 @@
⟨ 450 451 452 453 454 455 456 457 458 459 ⟩
</pre>
<p>If an element of <code><span class='Value'>𝕨</span></code> has rank more than 1, it increases the rank of <code><span class='Value'>𝕩</span></code> rather than decreasing it. The general rule is that in the result, one axis of <code><span class='Value'>𝕩</span></code> is replaced by all the axes of the corresponding element of <code><span class='Value'>𝕨</span></code> (trailing axes are unchanged). So the final shape <code><span class='Function'>≢</span><span class='Value'>𝕨</span><span class='Function'>⊏</span><span class='Value'>𝕩</span></code> is <code><span class='Paren'>(</span><span class='Function'>∾≢</span><span class='Modifier'>¨</span><span class='Value'>𝕨</span><span class='Paren'>)</span><span class='Function'>∾</span><span class='Value'>𝕨</span><span class='Function'>≠</span><span class='Modifier2'>⊸</span><span class='Function'>↓≢</span><span class='Value'>𝕩</span></code>. But this shape doesn't affect the elements retrieved from <code><span class='Value'>𝕩</span></code>. In all cases, using <code><span class='Function'>⥊</span><span class='Modifier'>¨</span><span class='Value'>𝕨</span></code> for the left argument and then <a href="reshape.html">reshaping</a> the result would yield the same value.</p>
-<p>Selection only ever applies to leading axes of <code><span class='Value'>𝕩</span></code>. However, you can skip some leading axes using <code><span class='Modifier'>˘</span></code> or <code><span class='Modifier2'>⎉</span></code>, to select on any contiguous set of axes. In particular, use the one-axis case <code><span class='Value'>𝕨</span><span class='Modifier2'>⊸</span><span class='Function'>⊏</span><span class='Modifier2'>⎉</span><span class='Paren'>(</span><span class='Function'>-</span><span class='Value'>k</span><span class='Paren'>)</span> <span class='Value'>𝕩</span></code> to select along axis <code><span class='Value'>k</span></code> of <code><span class='Value'>𝕩</span></code>.</p>
+<p>Selection only ever applies to leading axes of <code><span class='Value'>𝕩</span></code>. However, you can skip some leading axes using <a href="rank.html">Rank</a> modifiers <code><span class='Modifier'>˘</span></code> or <code><span class='Modifier2'>⎉</span></code>, to select on any contiguous set of axes. In particular, use the one-axis case <code><span class='Value'>𝕨</span><span class='Modifier2'>⊸</span><span class='Function'>⊏</span><span class='Modifier2'>⎉</span><span class='Paren'>(</span><span class='Function'>-</span><span class='Value'>k</span><span class='Paren'>)</span> <span class='Value'>𝕩</span></code> to select along axis <code><span class='Value'>k</span></code> of <code><span class='Value'>𝕩</span></code>.</p>
diff --git a/docs/doc/selfcmp.html b/docs/doc/selfcmp.html
index e5a8aa84..05490758 100644
--- a/docs/doc/selfcmp.html
+++ b/docs/doc/selfcmp.html
@@ -131,7 +131,7 @@
</g>
</svg>
-<p>BQN has four self-search functions, Classify (<code><span class='Function'>⊐</span></code>), Occurrence Count (<code><span class='Function'>⊒</span></code>), Mark Firsts (<code><span class='Function'>∊</span></code>), and Deduplicate (<code><span class='Function'>⍷</span></code>). Each of these is a monadic function that obtains its result by comparing each major cell of the argument (which must have rank at least 1) to the earlier major cells with <a href="match.html">match</a>. For example, Mark Firsts indicates the cells that don't match any earlier cell, making them the first of their kind.</p>
+<p>BQN has four self-search functions, Classify (<code><span class='Function'>⊐</span></code>), Occurrence Count (<code><span class='Function'>⊒</span></code>), Mark Firsts (<code><span class='Function'>∊</span></code>), and Deduplicate (<code><span class='Function'>⍷</span></code>). Each of these is a monadic function that obtains its result by comparing each <a href="array.html#cells">major cell</a> of the argument (which must have rank at least 1) to the earlier major cells with <a href="match.html">match</a>. For example, Mark Firsts indicates the cells that don't match any earlier cell, which might be called the first of their kind.</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=4oiKICJhYmFhY2Ii">↗️</a><pre> <span class='Function'>∊</span> <span class='String'>&quot;abaacb&quot;</span>
⟨ 1 1 0 0 1 0 ⟩
</pre>
@@ -148,6 +148,22 @@
⟨ 1 1 0 1 0 ⟩
</pre>
<p>The result has one number for each major cell, or in other words is a list with the same length as its argument. Three self-search functions follow this pattern, but Deduplicate (<code><span class='Function'>⍷</span></code>) is different: it returns an array of the same rank but possibly a shorter length than the argument.</p>
+<h3 id="deduplicate"><a class="header" href="#deduplicate">Deduplicate</a></h3>
+<p>Deduplicate removes every major cell from the argument that matches an earlier cell, resulting in an array with the same rank but possibly a shorter length. It might also be described as returning the unique major cells of the argument, ordered by first occurrence. Deduplicate <a href="under.html">Under</a> <a href="reverse.html">Reverse</a> (<code><span class='Function'>⍷</span><span class='Modifier2'>⌾</span><span class='Function'>⌽</span></code>) orders by last occurrence instead.</p>
+<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=4o23ID4idGFrZSLigL8iZHJvcCLigL8iZHJvcCLigL8icGljayLigL8idGFrZSLigL8idGFrZSIKCuKNt+KMvuKMvSA+InRha2Ui4oC/ImRyb3Ai4oC/ImRyb3Ai4oC/InBpY2si4oC/InRha2Ui4oC/InRha2Ui">↗️</a><pre> <span class='Function'>⍷</span> <span class='Function'>&gt;</span><span class='String'>&quot;take&quot;</span><span class='Ligature'>‿</span><span class='String'>&quot;drop&quot;</span><span class='Ligature'>‿</span><span class='String'>&quot;drop&quot;</span><span class='Ligature'>‿</span><span class='String'>&quot;pick&quot;</span><span class='Ligature'>‿</span><span class='String'>&quot;take&quot;</span><span class='Ligature'>‿</span><span class='String'>&quot;take&quot;</span>
+┌─
+╵"take
+ drop
+ pick"
+ ┘
+
+ <span class='Function'>⍷</span><span class='Modifier2'>⌾</span><span class='Function'>⌽</span> <span class='Function'>&gt;</span><span class='String'>&quot;take&quot;</span><span class='Ligature'>‿</span><span class='String'>&quot;drop&quot;</span><span class='Ligature'>‿</span><span class='String'>&quot;drop&quot;</span><span class='Ligature'>‿</span><span class='String'>&quot;pick&quot;</span><span class='Ligature'>‿</span><span class='String'>&quot;take&quot;</span><span class='Ligature'>‿</span><span class='String'>&quot;take&quot;</span>
+┌─
+╵"drop
+ pick
+ take"
+ ┘
+</pre>
<h2 id="classify"><a class="header" href="#classify">Classify</a></h2>
<p>Classify is the universal self-search function, in that it preserves all the self-search information in its argument. It gives each different cell value a natural number, ordered by first appearance.</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=4oqQIDXigL824oC/MuKAvzLigL814oC/MQ==">↗️</a><pre> <span class='Function'>⊐</span> <span class='Number'>5</span><span class='Ligature'>‿</span><span class='Number'>6</span><span class='Ligature'>‿</span><span class='Number'>2</span><span class='Ligature'>‿</span><span class='Number'>2</span><span class='Ligature'>‿</span><span class='Number'>5</span><span class='Ligature'>‿</span><span class='Number'>1</span>
@@ -185,7 +201,7 @@
<span class='Function'>⊐</span> <span class='Function'>⍷</span> <span class='Value'>c</span>
⟨ 0 1 2 ⟩
</pre>
-<p>Applying both separately, in contrast, gives completely interesting results. These results contain all information from the original argument, as <code><span class='Function'>⍷</span></code> indicates which cells it contained and <code><span class='Function'>⊐</span></code> indicates where they were located. The function <a href="select.html">Select</a> (<code><span class='Function'>⊏</span></code>) reconstructs the argument from the two values.</p>
+<p>Applying both separately is a different story, and gives completely interesting results. These results contain all information from the original argument, as <code><span class='Function'>⍷</span></code> indicates which cells it contained and <code><span class='Function'>⊐</span></code> indicates where they were located. The function <a href="select.html">Select</a> (<code><span class='Function'>⊏</span></code>) reconstructs the argument from the two values.</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=4o23IGMK4oqQIGMKKOKKkGMpIOKKjyAo4o23Yyk=">↗️</a><pre> <span class='Function'>⍷</span> <span class='Value'>c</span>
┌─
╵"yellow
@@ -204,11 +220,10 @@
yellow"
</pre>
-<p>One way to view this relationship is to consider an idea from linear algebra, where an idempotent transformation is called a &quot;projection&quot;. That means that the argument might be any value but the result is part of a smaller class of values, and any argument from that smaller class is left the same. What arrays do the two functions project to? The result of Deduplicate is an array with no repeated major cells. The result of Classify is a list of natural numbers, but it also has an additional property: each number in the list is at most one higher than the previous numbers, and the first number is zero. This comes from the way Classify numbers the cells of its argument. When it finds a cell that hasn't appeared before (at a lower index), it always chooses the next higher number for it.</p>
-<p>Applying both Classify and Deduplicate gives an array that has both properties (this isn't the case for all pairs of projections—we need to know that Classify maintains the uniqueness property for Deduplicate and vice-versa). It has no duplicate major cells, <em>and</em> it's a list of natural numbers that starts with 0 and never goes up by more than one. Taken together, these are a tight constraint! The first element of the argument has to be 0. The next can't be 0 because it's already appeared, but it can't be more than one higher—it has to be 1. The next can't be 0 or 1, and has to be 2. And so on. So the result is always <code><span class='Function'>↕</span><span class='Value'>n</span></code> for some <code><span class='Value'>n</span></code>. In fact it's possible to determine the length as well, by noting that each function preserves the number of unique major cells in its argument. Classify does this because distinct numbers in the output correspond exactly to distinct major cells in the input; Deduplicate does this because it only removes duplicate cells, not distinct ones. So the final result is <code><span class='Function'>↕</span><span class='Value'>n</span></code>, where <code><span class='Value'>n</span></code> is the number of unique major cells in the argument.</p>
+<p>One way to view this relationship is from the perspective of linear algebra, where an idempotent transformation is called a &quot;projection&quot;. That means that the argument might be any value but the result is part of a smaller class of values, and any argument from that smaller class is left the same. What arrays do the two functions project to? The result of Deduplicate is an array with no repeated major cells. The result of Classify is a list of natural numbers, but it also has an additional property: each number in the list is at most one higher than the previous numbers, and the first number is zero. This comes from the way Classify numbers the cells of its argument. When it finds a cell that hasn't appeared before (at a lower index), it always chooses the next higher number for it.</p>
+<p>Applying both Classify and Deduplicate gives an array that has both properties (this isn't the case for all pairs of projections—we need to know that Classify maintains the uniqueness property for Deduplicate and vice-versa). It has no duplicate major cells, <em>and</em> it's a list of natural numbers that starts with 0 and never goes up by more than one. Taken together, these are a tight constraint! The first element of the argument has to be 0. The next can't be 0 because it's already appeared, but it can't be more than one higher—it has to be 1. The next can't be 0 or 1, and has to be 2. And so on. So the result is always <code><span class='Function'>↕</span><span class='Value'>n</span></code> for some <code><span class='Value'>n</span></code>. It's possible to determine the length as well, by noting that each function preserves the number of unique major cells in its argument. Classify does this because distinct numbers in the output correspond exactly to distinct major cells in the input; Deduplicate does this because it only removes duplicate cells, not distinct ones. So the final result is <code><span class='Function'>↕</span><span class='Value'>n</span></code>, where <code><span class='Value'>n</span></code> is the number of unique major cells in the argument.</p>
<h3 id="mark-firsts"><a class="header" href="#mark-firsts">Mark Firsts</a></h3>
-<p><em>See the <a href="https://aplwiki.com/wiki/Unique_Mask">APL Wiki page</a> on this function as well.</em></p>
-<p>Mark Firsts (<code><span class='Function'>∊</span></code>) is the simplest self-search function: it returns <code><span class='Number'>0</span></code> for any major cell of the argument that is a duplicate of an earlier cell and <code><span class='Number'>1</span></code> for a major cell that's the first with its value. To implement <a href="#deduplicate">Deduplicate</a> in terms of Mark Firsts, just <a href="replicate.html">filter</a> out the duplicates with <code><span class='Function'>∊</span><span class='Modifier2'>⊸</span><span class='Function'>/</span></code>.</p>
+<p>Mark Firsts (<code><span class='Function'>∊</span></code>) is the simplest numeric self-search function: it returns <code><span class='Number'>0</span></code> for any major cell of the argument that is a duplicate of an earlier cell and <code><span class='Number'>1</span></code> for a major cell that's the first with its value. To implement <a href="#deduplicate">Deduplicate</a> in terms of Mark Firsts, just <a href="replicate.html">filter</a> out the duplicates with <code><span class='Function'>∊</span><span class='Modifier2'>⊸</span><span class='Function'>/</span></code>.</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=4oiKICAgM+KAvzHigL804oC/MeKAvzXigL854oC/MuKAvzbigL81CgriiIriirgvIDPigL8x4oC/NOKAvzHigL814oC/OeKAvzLigL824oC/NQ==">↗️</a><pre> <span class='Function'>∊</span> <span class='Number'>3</span><span class='Ligature'>‿</span><span class='Number'>1</span><span class='Ligature'>‿</span><span class='Number'>4</span><span class='Ligature'>‿</span><span class='Number'>1</span><span class='Ligature'>‿</span><span class='Number'>5</span><span class='Ligature'>‿</span><span class='Number'>9</span><span class='Ligature'>‿</span><span class='Number'>2</span><span class='Ligature'>‿</span><span class='Number'>6</span><span class='Ligature'>‿</span><span class='Number'>5</span>
⟨ 1 1 1 0 1 1 1 1 0 ⟩
@@ -248,21 +263,3 @@
⟨ 0 1 0 1 2 0 1 2 3 ⟩
</pre>
<p>A more efficient way when <code><span class='Function'>⊒</span></code> doesn't have a fast implementation is <code><span class='Function'>/</span><span class='Paren'>(</span><span class='Number'>¯1</span><span class='Modifier2'>⊸</span><span class='Function'>⊑↕</span><span class='Modifier2'>⊸</span><span class='Function'>-⊏</span><span class='Modifier2'>⟜</span><span class='Function'>»</span><span class='Paren'>)</span><span class='Function'>+</span><span class='Modifier'>`</span></code>, but that's clearly quite a bit more complicated.</p>
-<h3 id="deduplicate"><a class="header" href="#deduplicate">Deduplicate</a></h3>
-<p><em>There's also an <a href="https://aplwiki.com/wiki/Unique">APL Wiki page</a> on this function.</em></p>
-<p>Deduplicate removes every major cell from the argument that matches an earlier cell, resulting in an array with the same rank but possibly a shorter length. It might also be described as returning the unique major cells of the argument, ordered by first occurrence. Deduplicate <a href="under.html">Under</a> Reverse (<code><span class='Function'>⍷</span><span class='Modifier2'>⌾</span><span class='Function'>⌽</span></code>) orders by last occurrence instead.</p>
-<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=4o23ID4idGFrZSLigL8iZHJvcCLigL8iZHJvcCLigL8icGljayLigL8idGFrZSLigL8idGFrZSIKCuKNt+KMvuKMvSA+InRha2Ui4oC/ImRyb3Ai4oC/ImRyb3Ai4oC/InBpY2si4oC/InRha2Ui4oC/InRha2Ui">↗️</a><pre> <span class='Function'>⍷</span> <span class='Function'>&gt;</span><span class='String'>&quot;take&quot;</span><span class='Ligature'>‿</span><span class='String'>&quot;drop&quot;</span><span class='Ligature'>‿</span><span class='String'>&quot;drop&quot;</span><span class='Ligature'>‿</span><span class='String'>&quot;pick&quot;</span><span class='Ligature'>‿</span><span class='String'>&quot;take&quot;</span><span class='Ligature'>‿</span><span class='String'>&quot;take&quot;</span>
-┌─
-╵"take
- drop
- pick"
- ┘
-
- <span class='Function'>⍷</span><span class='Modifier2'>⌾</span><span class='Function'>⌽</span> <span class='Function'>&gt;</span><span class='String'>&quot;take&quot;</span><span class='Ligature'>‿</span><span class='String'>&quot;drop&quot;</span><span class='Ligature'>‿</span><span class='String'>&quot;drop&quot;</span><span class='Ligature'>‿</span><span class='String'>&quot;pick&quot;</span><span class='Ligature'>‿</span><span class='String'>&quot;take&quot;</span><span class='Ligature'>‿</span><span class='String'>&quot;take&quot;</span>
-┌─
-╵"drop
- pick
- take"
- ┘
-</pre>
-<p>The relationship between Classify and Deduplicate is discussed <a href="#classify-and-deduplicate">above</a>.</p>
diff --git a/docs/doc/shape.html b/docs/doc/shape.html
index 80cfb45e..50140270 100644
--- a/docs/doc/shape.html
+++ b/docs/doc/shape.html
@@ -5,10 +5,10 @@
</head>
<div class="nav">(<a href="https://github.com/mlochbaum/BQN">github</a>) / <a href="../index.html">BQN</a> / <a href="index.html">doc</a></div>
<h1 id="array-dimensions"><a class="header" href="#array-dimensions">Array dimensions</a></h1>
-<p>The function Shape (<code><span class='Function'>≢</span></code>) returns an array's shape, and Rank (<code><span class='Function'>=</span></code>) and Length (<code><span class='Function'>≠</span></code>) return properties that can be derived from the shape. BQN's arrays are multidimensional, so that the shape is a list of natural numbers (the length along each axis), while the rank (length of the shape) and length (of the first axis) are numbers. In these functions, an atom is treated as a unit array, which has rank 0 and empty shape. A unit has no first axis, but its length is defined to be 1.</p>
+<p>The function Shape (<code><span class='Function'>≢</span></code>) returns an array's shape, and Rank (<code><span class='Function'>=</span></code>) and Length (<code><span class='Function'>≠</span></code>) return properties that can be derived from the shape. BQN's <a href="array.html">arrays</a> are multidimensional, so that the shape is a list of natural numbers (the length along each axis), while the rank (length of the shape) and length (of the first axis) are numbers. In these functions, an atom is treated as a unit array, which has rank 0 and empty shape. A unit has no first axis, but its length is defined to be 1.</p>
<p>Rank can be defined as <code><span class='Function'>≠</span><span class='Modifier2'>∘</span><span class='Function'>≢</span></code> while Length can be defined with a <a href="fold.html">fold</a> to be <code><span class='Number'>1</span><span class='Function'>⊣</span><span class='Modifier'>´</span><span class='Function'>≢</span></code>.</p>
<h2 id="examples"><a class="header" href="#examples">Examples</a></h2>
-<p>The function <a href="reshape.html">Reshape</a> (<code><span class='Function'>⥊</span></code>) always returns an array of shape <code><span class='Value'>𝕨</span></code>, so we use it to make an array of shape <code><span class='Number'>1</span><span class='Ligature'>‿</span><span class='Number'>3</span><span class='Ligature'>‿</span><span class='Number'>2</span><span class='Ligature'>‿</span><span class='Number'>6</span></code> in the example below (<a href="take.html">Take</a> (<code><span class='Function'>↑</span></code>) shares this property if <code><span class='Paren'>(</span><span class='Function'>≠</span><span class='Value'>𝕨</span><span class='Paren'>)</span><span class='Function'>≤=</span><span class='Value'>𝕩</span></code>).</p>
+<p>The function <a href="reshape.html">Reshape</a> (<code><span class='Function'>⥊</span></code>) always returns an array of shape <code><span class='Value'>𝕨</span></code>, so we use it to make an array of shape <code><span class='Number'>1</span><span class='Ligature'>‿</span><span class='Number'>3</span><span class='Ligature'>‿</span><span class='Number'>2</span><span class='Ligature'>‿</span><span class='Number'>6</span></code> in the example below (<a href="take.html">Take</a> (<code><span class='Function'>↑</span></code>) shares this property if <code><span class='Paren'>(</span><span class='Function'>≠</span><span class='Value'>𝕨</span><span class='Paren'>)</span><span class='Function'>≥=</span><span class='Value'>𝕩</span></code>).</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=4oqiIGFyciDihpAgMeKAvzPigL8y4oC/NiDipYogJzAnK+KGlTEwCgriiaIgYXJyICAjIFNoYXBlCgriiaAgYXJyICAjIExlbmd0aAoKPSBhcnIgICMgUmFuaw==">↗️</a><pre> <span class='Function'>⊢</span> <span class='Value'>arr</span> <span class='Gets'>←</span> <span class='Number'>1</span><span class='Ligature'>‿</span><span class='Number'>3</span><span class='Ligature'>‿</span><span class='Number'>2</span><span class='Ligature'>‿</span><span class='Number'>6</span> <span class='Function'>⥊</span> <span class='String'>'0'</span><span class='Function'>+↕</span><span class='Number'>10</span>
┌─
┆"012345
@@ -45,7 +45,7 @@
⟨ 0 1 ⟩
</pre>
<h2 id="units"><a class="header" href="#units">Units</a></h2>
-<p>A unit is an atom, or an array with no axes—rank 0. (See <a href="enclose.html">Enclose</a> for more about unit arrays). Since it doesn't have any axes, its shape should have no elements. It should be the empty list <code><span class='Bracket'>⟨⟩</span></code> (with a fill of <code><span class='Number'>0</span></code>, like all shapes). As there's no first element in the shape, it's not obvious what the length should be, and a stricter language would just give an error. However, there are some good reasons to use a length of <code><span class='Number'>1</span></code>. First, the total number of elements is 1, meaning that if the length divides this number evenly (as it does for non-unit arrays) then the only possible natural number it can be is 1. Second, many functions that take a list for a particular argument also accept a unit, and treat it as a length-1 array. For example, <code><span class='Number'>5</span><span class='Function'>⥊</span><span class='Value'>a</span></code> and <code><span class='Bracket'>⟨</span><span class='Number'>5</span><span class='Bracket'>⟩</span><span class='Function'>⥊</span><span class='Value'>a</span></code> are identical. Defining <code><span class='Function'>≠</span><span class='Number'>5</span></code> to be <code><span class='Number'>1</span></code> means that <code><span class='Function'>=</span><span class='Value'>s</span><span class='Function'>⥊</span><span class='Value'>a</span></code> is always <code><span class='Function'>≠</span><span class='Value'>s</span></code>.</p>
+<p>A <a href="enclose.html#whats-a-unit">unit</a> is an atom, or an array with no axes—rank 0. Since it doesn't have any axes, its shape should have no elements. It should be the empty list <code><span class='Bracket'>⟨⟩</span></code> (with a <a href="fill.html">fill</a> of <code><span class='Number'>0</span></code>, like all shapes). As there's no first element in the shape, it's not obvious what the length should be, and a stricter language would just give an error. However, there are some good reasons to use a length of <code><span class='Number'>1</span></code>. First, the total number of elements is 1, meaning that if the length divides this number evenly (as it does for non-unit arrays) then the only possible natural number it can be is 1. Second, many functions that take a list for a particular argument also accept a unit, and treat it as a length-1 array. For example, <code><span class='Number'>5</span><span class='Function'>⥊</span><span class='Value'>a</span></code> and <code><span class='Bracket'>⟨</span><span class='Number'>5</span><span class='Bracket'>⟩</span><span class='Function'>⥊</span><span class='Value'>a</span></code> are identical. Defining <code><span class='Function'>≠</span><span class='Number'>5</span></code> to be <code><span class='Number'>1</span></code> means that <code><span class='Function'>=</span><span class='Value'>s</span><span class='Function'>⥊</span><span class='Value'>a</span></code> is always <code><span class='Function'>≠</span><span class='Value'>s</span></code>.</p>
<p>Despite this last point, it's important to remember that a unit isn't the same as a 1-element list. For example, the length-1 string <code><span class='String'>&quot;a&quot;</span></code> doesn't match <code><span class='Function'>&lt;</span><span class='String'>'a'</span></code> but instead <code><span class='Bracket'>⟨</span><span class='String'>'a'</span><span class='Bracket'>⟩</span></code>. And also bear in mind that having an empty <em>shape</em> doesn't make a unit an empty <em>array</em>. That would mean it has no elements, not one!</p>
<table>
<thead>