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.html2
1 files changed, 1 insertions, 1 deletions
diff --git a/docs/doc/enclose.html b/docs/doc/enclose.html
index b526c28d..ce7d6cf9 100644
--- a/docs/doc/enclose.html
+++ b/docs/doc/enclose.html
@@ -117,7 +117,7 @@ ERROR
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=PeKAv+KJoOKAv+KJoeKAv+KJoiB78J2VjvCdlal9wqggPCAz4oC/MuKliiJhYmNkZWYi">↗️</a><pre> <span class='Function'>=</span><span class='Ligature'>‿</span><span class='Function'>≠</span><span class='Ligature'>‿</span><span class='Function'>≡</span><span class='Ligature'>‿</span><span class='Function'>≢</span> <span class='Brace'>{</span><span class='Function'>𝕎</span><span class='Value'>𝕩</span><span class='Brace'>}</span><span class='Modifier'>¨</span> <span class='Function'>&lt;</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>
⟨ 2 3 1 ⟨ 3 2 ⟩ ⟩
</pre>
-<p>The function <code><span class='Brace'>{</span><span class='Function'>𝕎</span><span class='Value'>𝕩</span><span class='Brace'>}</span></code> applies its left argument as a function to its right; we want to apply the four functions Rank, Length, <a href="depth.html">Depth</a>, and <a href="shape.html">Shape</a> to a single array. Each normally matches up elements from its two arguments, but it will also copy the elements of a lower-rank argument to fill in any missing trailing axes and match the higher-rank argument's shape. To copy a single argument for every function call, it should have no axes, so we enclose it into a unit.</p>
+<p>The function <code><span class='Brace'>{</span><span class='Function'>𝕎</span><span class='Value'>𝕩</span><span class='Brace'>}</span></code> applies its left argument as a function to its right; we want to apply the four functions Rank, Length, <a href="depth.html">Depth</a>, and <a href="shape.html">Shape</a> to a single array. Normally Each matches up elements from its two arguments, but it will also copy the elements of a lower-rank argument to fill in any missing trailing axes and match the higher-rank argument's shape. To copy a single argument for every function call, it should have no axes, so we enclose it into a unit.</p>
<p>This example would work just as well with Table (<code><span class='Modifier'>⌜</span></code>), although maybe the interpretation is a little different. The reason it matters that Each accepts unit arrays is that arithmetic primitives (as well as the Depth modifier <code><span class='Modifier2'>⚇</span></code>) use Each to match their arguments up. Want to add a point (two numbers) to each point in an array? Just enclose it first.</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=KDwxMOKAv8KvMTApICsg4p+oMuKAvzMsMeKAvzfin6niiY3in6g04oC/MSw14oC/NOKfqQ==">↗️</a><pre> <span class='Paren'>(</span><span class='Function'>&lt;</span><span class='Number'>10</span><span class='Ligature'>‿</span><span class='Number'>¯10</span><span class='Paren'>)</span> <span class='Function'>+</span> <span class='Bracket'>⟨</span><span class='Number'>2</span><span class='Ligature'>‿</span><span class='Number'>3</span><span class='Separator'>,</span><span class='Number'>1</span><span class='Ligature'>‿</span><span class='Number'>7</span><span class='Bracket'>⟩</span><span class='Function'>≍</span><span class='Bracket'>⟨</span><span class='Number'>4</span><span class='Ligature'>‿</span><span class='Number'>1</span><span class='Separator'>,</span><span class='Number'>5</span><span class='Ligature'>‿</span><span class='Number'>4</span><span class='Bracket'>⟩</span>
┌─