aboutsummaryrefslogtreecommitdiff
path: root/docs/doc/join.html
diff options
context:
space:
mode:
Diffstat (limited to 'docs/doc/join.html')
-rw-r--r--docs/doc/join.html9
1 files changed, 6 insertions, 3 deletions
diff --git a/docs/doc/join.html b/docs/doc/join.html
index 9f93eae4..e2876a74 100644
--- a/docs/doc/join.html
+++ b/docs/doc/join.html
@@ -11,7 +11,7 @@
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=ImFiY2QiIOKIviAiRUZHIg==">↗️</a><pre> <span class='String'>&quot;abcd&quot;</span> <span class='Function'>∾</span> <span class='String'>&quot;EFG&quot;</span>
"abcdEFG"
</pre>
-<p>If the arguments have the same rank, then they are combined along the first axis: the result is an array whose major cells are the major cells of <code><span class='Value'>𝕨</span></code> followed by the major cells of <code><span class='Value'>𝕩</span></code>. For arrays with rank two or more, this means they will be joined &quot;vertically&quot; according to BQN's display.</p>
+<p>If the arguments have the same rank, then they are combined along the first axis: the result is an array whose <a href="array.html#cells">major cells</a> are the major cells of <code><span class='Value'>𝕨</span></code> followed by the major cells of <code><span class='Value'>𝕩</span></code>. For arrays with rank two or more, this means they will be joined &quot;vertically&quot; according to BQN's <a href="arrayrepr.html#array-display">display</a>.</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=4oqiIGEg4oaQIDMgK+KMnOKXi+KGlSA0CuKKoiBiIOKGkCAy4oC/NCDipYog4oaVOAphIOKIviBi">↗️</a><pre> <span class='Function'>⊢</span> <span class='Value'>a</span> <span class='Gets'>←</span> <span class='Number'>3</span> <span class='Function'>+</span><span class='Modifier'>⌜</span><span class='Modifier2'>○</span><span class='Function'>↕</span> <span class='Number'>4</span>
┌─
╵ 0 1 2 3
@@ -57,8 +57,11 @@
"timetojoinsomewords"
</pre>
<p>To join with a separator in between, we might prepend the separator to each string, then remove the leading separator after joining. Another approach would be to insert the separator array as an element between each pair of array elements before calling Join.</p>
-<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=MeKGk+KIvicgJ+KIvsKoInRpbWUi4oC/InRvIuKAvyJqb2luIuKAvyJzb21lIuKAvyJ3b3JkcyI=">↗️</a><pre> <span class='Number'>1</span><span class='Function'>↓∾</span><span class='String'>' '</span><span class='Function'>∾</span><span class='Modifier'>¨</span><span class='String'>&quot;time&quot;</span><span class='Ligature'>‿</span><span class='String'>&quot;to&quot;</span><span class='Ligature'>‿</span><span class='String'>&quot;join&quot;</span><span class='Ligature'>‿</span><span class='String'>&quot;some&quot;</span><span class='Ligature'>‿</span><span class='String'>&quot;words&quot;</span>
+<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=MeKGk+KIvicgJ+KIvsKoInRpbWUi4oC/InRvIuKAvyJqb2luIuKAvyJzb21lIuKAvyJ3b3JkcyIKCuKIvjHihpPipYooPCIgKiAiKeKJjcuYInRpbWUi4oC/InRvIuKAvyJqb2luIuKAvyJzb21lIuKAvyJ3b3JkcyI=">↗️</a><pre> <span class='Number'>1</span><span class='Function'>↓∾</span><span class='String'>' '</span><span class='Function'>∾</span><span class='Modifier'>¨</span><span class='String'>&quot;time&quot;</span><span class='Ligature'>‿</span><span class='String'>&quot;to&quot;</span><span class='Ligature'>‿</span><span class='String'>&quot;join&quot;</span><span class='Ligature'>‿</span><span class='String'>&quot;some&quot;</span><span class='Ligature'>‿</span><span class='String'>&quot;words&quot;</span>
"time to join some words"
+
+ <span class='Function'>∾</span><span class='Number'>1</span><span class='Function'>↓⥊</span><span class='Paren'>(</span><span class='Function'>&lt;</span><span class='String'>&quot; * &quot;</span><span class='Paren'>)</span><span class='Function'>≍</span><span class='Modifier'>˘</span><span class='String'>&quot;time&quot;</span><span class='Ligature'>‿</span><span class='String'>&quot;to&quot;</span><span class='Ligature'>‿</span><span class='String'>&quot;join&quot;</span><span class='Ligature'>‿</span><span class='String'>&quot;some&quot;</span><span class='Ligature'>‿</span><span class='String'>&quot;words&quot;</span>
+"time * to * join * some * words"
</pre>
<p>Join also extends the rank of a unit element (including an atom) to allow it to fit into the list. The highest-rank element determines the rank of the result.</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=4oi+ImFiYyLigL8nZCfigL8iZWYi4oC/KDwnZycpCgriiL4iYWJjZCIgICMgUmVzdWx0IGhhcyB0byBiZSByYW5rIDAsIGltcG9zc2libGU=">↗️</a><pre> <span class='Function'>∾</span><span class='String'>&quot;abc&quot;</span><span class='Ligature'>‿</span><span class='String'>'d'</span><span class='Ligature'>‿</span><span class='String'>&quot;ef&quot;</span><span class='Ligature'>‿</span><span class='Paren'>(</span><span class='Function'>&lt;</span><span class='String'>'g'</span><span class='Paren'>)</span>
@@ -67,7 +70,7 @@
<span class='Function'>∾</span><span class='String'>&quot;abcd&quot;</span> <span class='Comment'># Result has to be rank 0, impossible
</span><span class='Error'>Error: ∾𝕩: 𝕩 must have an element with rank at least =𝕩</span>
</pre>
-<p>However, Join has higher-dimensional uses as well. Given a rank-<code><span class='Value'>m</span></code> array of rank-<code><span class='Value'>n</span></code> arrays (requiring <code><span class='Value'>m</span><span class='Function'>≤</span><span class='Value'>n</span></code>), it will merge arrays along their first <code><span class='Value'>m</span></code> axes. For example, if the argument is a matrix of matrices representing a <a href="https://en.wikipedia.org/wiki/Block_matrix">block matrix</a>, Join will give the corresponding unblocked matrix as its result.</p>
+<p>Join has higher-dimensional uses as well. Given a rank-<code><span class='Value'>m</span></code> array of rank-<code><span class='Value'>n</span></code> arrays (requiring <code><span class='Value'>m</span><span class='Function'>≤</span><span class='Value'>n</span></code>), it will merge arrays along their first <code><span class='Value'>m</span></code> axes. For example, if the argument is a matrix of matrices representing a <a href="https://en.wikipedia.org/wiki/Block_matrix">block matrix</a>, Join will give the corresponding unblocked matrix as its result.</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=4oqiIG0g4oaQICgz4oC/MeKJjeKMnDTigL8y4oC/NSkg4qWKwqggMuKAvzPipYrihpU2CuKIviBtICAjIEpvaW4gYWxsIHRoYXQgdG9nZXRoZXI=">↗️</a><pre> <span class='Function'>⊢</span> <span class='Value'>m</span> <span class='Gets'>←</span> <span class='Paren'>(</span><span class='Number'>3</span><span class='Ligature'>‿</span><span class='Number'>1</span><span class='Function'>≍</span><span class='Modifier'>⌜</span><span class='Number'>4</span><span class='Ligature'>‿</span><span class='Number'>2</span><span class='Ligature'>‿</span><span class='Number'>5</span><span class='Paren'>)</span> <span class='Function'>⥊</span><span class='Modifier'>¨</span> <span class='Number'>2</span><span class='Ligature'>‿</span><span class='Number'>3</span><span class='Function'>⥊↕</span><span class='Number'>6</span>
┌─
╵ ┌─ ┌─ ┌─