blob: 17719fdf0627b85bc171a54f60025de9d13e7677 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
<head>
<link href="../favicon.ico" rel="shortcut icon" type="image/x-icon"/>
<link href="../style.css" rel="stylesheet"/>
<title>BQN: Circle Backslash (`⍉`)</title>
</head>
<div class="nav">(<a href="https://github.com/mlochbaum/BQN">github</a>) / <a href="../index.html">BQN</a> / <a href="index.html">help</a></div>
<h1 id="circle-backslash-"><a class="header" href="#circle-backslash-">Circle Backslash (<code><span class='Function'>⍉</span></code>)</a></h1>
<h2 id="--transpose-"><a class="header" href="#--transpose-"><code><span class='Function'>⍉</span> <span class='Value'>𝕩</span></code>: Transpose</a></h2>
<p>Move the first axis of <code><span class='Value'>𝕩</span></code> to the end.</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=ICAgYSDihpAgM+KAvzMg4qWKIOKGlTkKCiAgIOKNiSBhCgogICBiIOKGkCAx4oC/MuKAvzMg4qWKIOKGlTYKCiAgIOKJouKNiSBi">↗️</a><pre> <span class='Value'>a</span> <span class='Gets'>←</span> <span class='Number'>3</span><span class='Ligature'>‿</span><span class='Number'>3</span> <span class='Function'>⥊</span> <span class='Function'>↕</span><span class='Number'>9</span>
<span class='Function'>⍉</span> <span class='Value'>a</span>
┌─
╵ 0 3 6
1 4 7
2 5 8
┘
<span class='Value'>b</span> <span class='Gets'>←</span> <span class='Number'>1</span><span class='Ligature'>‿</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>
<span class='Function'>≢⍉</span> <span class='Value'>b</span>
⟨ 2 3 1 ⟩
</pre>
<h2 id="---reorder-axes"><a class="header" href="#---reorder-axes"><code><span class='Value'>𝕨</span> <span class='Function'>⍉</span> <span class='Value'>𝕩</span></code>: Reorder Axes</a></h2>
<p>Rearrange the axes of <code><span class='Value'>𝕩</span></code> as per the axis indices in <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=ICAg4omiIGEg4oaQIDLigL8z4oC/NOKAvzXigL82IOKlijEKCiAgIOKJoiAx4oC/M+KAvzLigL8w4oC/NCDijYkgYQ==">↗️</a><pre> <span class='Function'>≢</span> <span class='Value'>a</span> <span class='Gets'>←</span> <span class='Number'>2</span><span class='Ligature'>‿</span><span class='Number'>3</span><span class='Ligature'>‿</span><span class='Number'>4</span><span class='Ligature'>‿</span><span class='Number'>5</span><span class='Ligature'>‿</span><span class='Number'>6</span> <span class='Function'>⥊</span><span class='Number'>1</span>
<span class='Error'>Error: Redefinition</span>
<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='Value'>a</span>
<span class='Error'>Error: 𝕨⍉𝕩: Length of 𝕨 must not exceed rank of 𝕩</span>
</pre>
|