aboutsummaryrefslogtreecommitdiff
path: root/docs/doc/replicate.html
diff options
context:
space:
mode:
Diffstat (limited to 'docs/doc/replicate.html')
-rw-r--r--docs/doc/replicate.html8
1 files changed, 4 insertions, 4 deletions
diff --git a/docs/doc/replicate.html b/docs/doc/replicate.html
index 1e1fabc5..6ffec63c 100644
--- a/docs/doc/replicate.html
+++ b/docs/doc/replicate.html
@@ -149,7 +149,7 @@
</pre>
<p>Here the <code><span class='Number'>2</span><span class='Ligature'>‿</span><span class='Number'>0</span></code> indicates that the first row of <code><span class='Value'>b</span></code> is copied twice and the second is ignored, while <code><span class='Number'>1</span><span class='Ligature'>‿</span><span class='Number'>0</span><span class='Ligature'>‿</span><span class='Number'>0</span><span class='Ligature'>‿</span><span class='Number'>1</span><span class='Ligature'>‿</span><span class='Number'>1</span></code> picks out three entries from that row. As in the single-axis case, <code><span class='Value'>𝕩</span></code> can have extra trailing axes that aren't modified by <code><span class='Value'>𝕨</span></code>. The rules are that <code><span class='Value'>𝕨</span></code> can't have <em>more</em> elements than axes of <code><span class='Value'>𝕩</span></code> (so <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>), and that each element has to have the same length as the corresponding axis—or it can be a unit, as shown below.</p>
-<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=4p+oPDIsPDPin6kgLyBi">↗️</a><pre> <span class='Bracket'>⟨</span><span class='Function'>&lt;</span><span class='Number'>2</span><span class='Separator'>,</span><span class='Function'>&lt;</span><span class='Number'>3</span><span class='Bracket'>⟩</span> <span class='Function'>/</span> <span class='Value'>b</span>
+<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=4oqiIGIg4oaQIDLigL81IOKliiDihpUxMArin6g8Miw8M+KfqSAvIGI=">↗️</a><pre> <span class='Bracket'>⟨</span><span class='Function'>&lt;</span><span class='Number'>2</span><span class='Separator'>,</span><span class='Function'>&lt;</span><span class='Number'>3</span><span class='Bracket'>⟩</span> <span class='Function'>/</span> <span class='Value'>b</span>
┌─
╵ 0 0 0 1 1 1 2 2 2 3 3 3 4 4 4
0 0 0 1 1 1 2 2 2 3 3 3 4 4 4
@@ -158,7 +158,7 @@
</pre>
<p>Above, both elements of <code><span class='Value'>𝕨</span></code> are <a href="enclose.html">enclosed</a> numbers. An individual element doesn't have to be enclosed, but I don't recommend this, since if <em>none</em> of them are enclosed, then <code><span class='Value'>𝕨</span></code> will have depth 1 and it will be interpreted as replicating along the first axis only.</p>
-<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=4p+oMiwz4p+pIC8gYg==">↗️</a><pre> <span class='Bracket'>⟨</span><span class='Number'>2</span><span class='Separator'>,</span><span class='Number'>3</span><span class='Bracket'>⟩</span> <span class='Function'>/</span> <span class='Value'>b</span>
+<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=4oqiIGIg4oaQIDLigL81IOKliiDihpUxMArin6gyLDPin6kgLyBi">↗️</a><pre> <span class='Bracket'>⟨</span><span class='Number'>2</span><span class='Separator'>,</span><span class='Number'>3</span><span class='Bracket'>⟩</span> <span class='Function'>/</span> <span class='Value'>b</span>
┌─
╵ 0 1 2 3 4
0 1 2 3 4
@@ -169,7 +169,7 @@
</pre>
<p>The example above has a different result from the previous one! The function <code><span class='Function'>&lt;</span><span class='Modifier'>¨</span><span class='Modifier2'>⊸</span><span class='Function'>/</span></code> could be used in place of <code><span class='Function'>/</span></code> to replicate each axis by a different number.</p>
<p>If <code><span class='Value'>𝕨</span></code> is <code><span class='Bracket'>⟨⟩</span></code>, then it has depth 1, but is handled with the multidimensional case anyway, giving a result of <code><span class='Value'>𝕩</span></code>. The one-dimensional case could also only ever return <code><span class='Value'>𝕩</span></code>, but it would be required to have length 0, so this convention still only extends the simple case.</p>
-<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=YiDiiaEg4p+o4p+pIC8gYg==">↗️</a><pre> <span class='Value'>b</span> <span class='Function'>≡</span> <span class='Bracket'>⟨⟩</span> <span class='Function'>/</span> <span class='Value'>b</span>
+<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=4oqiIGIg4oaQIDLigL81IOKliiDihpUxMApiIOKJoSDin6jin6kgLyBi">↗️</a><pre> <span class='Value'>b</span> <span class='Function'>≡</span> <span class='Bracket'>⟨⟩</span> <span class='Function'>/</span> <span class='Value'>b</span>
1
</pre>
<h2 id="indices"><a class="header" href="#indices">Indices</a></h2>
@@ -243,7 +243,7 @@
<span class='Error'>Error: /: Argument must have rank 1 (3‿6 ≡ ≢𝕩)</span>
</pre>
<p>Error. But the two 1s are located at <code><span class='Number'>0</span><span class='Ligature'>‿</span><span class='Number'>3</span></code> and <code><span class='Number'>1</span><span class='Ligature'>‿</span><span class='Number'>2</span></code>. What's wrong with those? First, let's note that you can find these indices if you need to, using Replicate. Make the list of all indices <code><span class='Function'>↕≢</span><span class='Value'>𝕩</span></code>, and filter <a href="compose.html#over">Over</a> <a href="reshape.html#deshape">Deshape</a> (<code><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=L+KXi+KliuKfnCjihpXiiaIpIHI=">↗️</a><pre> <span class='Function'>/</span><span class='Modifier2'>○</span><span class='Function'>⥊</span><span class='Modifier2'>⟜</span><span class='Paren'>(</span><span class='Function'>↕≢</span><span class='Paren'>)</span> <span class='Value'>r</span>
+<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=4oqiIHIg4oaQIDHCqOKMvigz4oC/OOKKj+KliikgM+KAvzbipYowCi/il4vipYrin5wo4oaV4omiKSBy">↗️</a><pre> <span class='Function'>/</span><span class='Modifier2'>○</span><span class='Function'>⥊</span><span class='Modifier2'>⟜</span><span class='Paren'>(</span><span class='Function'>↕≢</span><span class='Paren'>)</span> <span class='Value'>r</span>
⟨ ⟨ 0 3 ⟩ ⟨ 1 2 ⟩ ⟩
</pre>
<p>The issue with this function is that it's not consistent with the result of <code><span class='Function'>/</span></code> on a list. This is because the extension gives <a href="indices.html#element-indices">element indices</a>, which are lists, while the original <code><span class='Function'>/</span></code> gives single-number indices, which is only possible when <code><span class='Value'>𝕩</span></code> has rank 1.</p>