diff options
| author | Marshall Lochbaum <mwlochbaum@gmail.com> | 2021-11-12 22:15:44 -0500 |
|---|---|---|
| committer | Marshall Lochbaum <mwlochbaum@gmail.com> | 2021-11-12 22:15:44 -0500 |
| commit | 59ab5338d4e23eb108a43f876aa979238ae2490e (patch) | |
| tree | 616acd22834a1aa42b030a0a28e024df43683dd8 /docs/doc/transpose.html | |
| parent | 3a5c72c7a3457560be2ca4a837eb5491e5b9e8b6 (diff) | |
Slightly less APL-centric documentation
Diffstat (limited to 'docs/doc/transpose.html')
| -rw-r--r-- | docs/doc/transpose.html | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/docs/doc/transpose.html b/docs/doc/transpose.html index 1cf882dc..fca1d637 100644 --- a/docs/doc/transpose.html +++ b/docs/doc/transpose.html @@ -5,7 +5,7 @@ </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="transpose"><a class="header" href="#transpose">Transpose</a></h1> -<p>Transpose (<code><span class='Function'>⍉</span></code>) is a tool for rearranging the axes of an array. BQN's version is tweaked relative to APL to align better with the leading axis model and make common operations easier.</p> +<p>Transpose (<code><span class='Function'>⍉</span></code>) is a tool for rearranging the axes of an array <code><span class='Value'>𝕩</span></code>. Without a left argument, it moves the first axis to the end, while a left argument can specify an arbitrary rearrangement. Both cases are tweaked relative to APL to align better with the <a href="leading.html">leading axis</a> model and make common operations easier.</p> <h2 id="transpose-basics"><a class="header" href="#transpose-basics">Transpose basics</a></h2> <p>The name for the primitive <code><span class='Function'>⍉</span></code> comes from the <a href="https://en.wikipedia.org/wiki/Transpose">Transpose</a> operation on matrices. Given a matrix as an array of rank 2, <code><span class='Function'>⍉</span></code> will transpose it:</p> <a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=4oqiIG1hdCDihpAgMuKAvzMg4qWKIOKGlTYK4o2JIG1hdA==">↗️</a><pre> <span class='Function'>⊢</span> <span class='Value'>mat</span> <span class='Gets'>←</span> <span class='Number'>2</span><span class='Ligature'>‿</span><span class='Number'>3</span> <span class='Function'>⥊</span> <span class='Function'>↕</span><span class='Number'>6</span> @@ -100,7 +100,7 @@ <a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=4omiIDHigL8z4oC/MuKAvzDigL80IOKNieKBvCBhMjM0NTY=">↗️</a><pre> <span class='Function'>≢</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'>0</span><span class='Ligature'>‿</span><span class='Number'>4</span> <span class='Function'>⍉</span><span class='Modifier'>⁼</span> <span class='Value'>a23456</span> ⟨ 3 5 4 2 6 ⟩ </pre> -<p>So far, all like APL. BQN makes one little extension, which is to allow only some axes to be specified. Then <code><span class='Value'>𝕨</span></code> will be matched up with <a href="leading.html">leading axes</a> of <code><span class='Value'>𝕩</span></code>. Those axes are moved according to <code><span class='Value'>𝕨</span></code>, and remaining axes are placed in order into the gaps between them.</p> +<p>BQN makes one further extension, which is to allow only some axes to be specified (this is the only difference in dyadic <code><span class='Function'>⍉</span></code> relative to APL). Then <code><span class='Value'>𝕨</span></code> will be matched up with <a href="leading.html">leading axes</a> of <code><span class='Value'>𝕩</span></code>. Those axes are moved according to <code><span class='Value'>𝕨</span></code>, and remaining axes are placed in order into the gaps between them.</p> <a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=4omiIDDigL8y4oC/NCDijYkgYTIzNDU2">↗️</a><pre> <span class='Function'>≢</span> <span class='Number'>0</span><span class='Ligature'>‿</span><span class='Number'>2</span><span class='Ligature'>‿</span><span class='Number'>4</span> <span class='Function'>⍉</span> <span class='Value'>a23456</span> ⟨ 2 5 3 6 4 ⟩ </pre> |
