diff options
| author | Marshall Lochbaum <mwlochbaum@gmail.com> | 2022-07-14 20:06:50 -0400 |
|---|---|---|
| committer | Marshall Lochbaum <mwlochbaum@gmail.com> | 2022-07-14 20:06:50 -0400 |
| commit | e2b07a5fd0bbaad232c717fb90a31d6c61d72bd4 (patch) | |
| tree | 8cd1d594838a87f4257e73d1e0e32d69ec4a148c /docs/doc/leading.html | |
| parent | fe13f4a775a83073cb44d8e47ec4fdf9ec957bed (diff) | |
Try to include previous variable definitions in REPL links
Diffstat (limited to 'docs/doc/leading.html')
| -rw-r--r-- | docs/doc/leading.html | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/docs/doc/leading.html b/docs/doc/leading.html index b3b008c8..63cdc85f 100644 --- a/docs/doc/leading.html +++ b/docs/doc/leading.html @@ -34,7 +34,7 @@ ┘ </pre> <p>To use these functions on another axis, use the <a href="rank.html#rank">Rank</a> (<code><span class='Modifier2'>⎉</span></code>) or <a href="rank.html#cells">Cells</a> (<code><span class='Modifier'>˘</span></code>) modifier to find the one you want. For a rank 2 array like <code><span class='Value'>a</span></code>, the most you'll ever need is a single <code><span class='Modifier'>˘</span></code>, because after the leading one there's only one other axis.</p> -<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=4oqPy5ggYSAgICAgICAgICAgICAgICAgICMgRmlyc3QgY29sdW1uCgrijL3LmCBhICAgICAgICAgICAgICAgICAgIyBTd2FwIHRoZSBjb2x1bW5zCgriiqNgy5ggYSAgICAgICAgICAgICAgICAgIyBSZXBsaWNhdGUgYWxvbmcgcm93cw==">↗️</a><pre> <span class='Function'>⊏</span><span class='Modifier'>˘</span> <span class='Value'>a</span> <span class='Comment'># First column +<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=4oqiIGEg4oaQIDPigL8yIOKliiAiYWJjZGVmIiAgIyBBbiBhcnJheSB3aXRoIHRocmVlIG1ham9yIGNlbGxzCuKKj8uYIGEgICAgICAgICAgICAgICAgICAjIEZpcnN0IGNvbHVtbgoK4oy9y5ggYSAgICAgICAgICAgICAgICAgICMgU3dhcCB0aGUgY29sdW1ucwoK4oqjYMuYIGEgICAgICAgICAgICAgICAgICMgUmVwbGljYXRlIGFsb25nIHJvd3M=">↗️</a><pre> <span class='Function'>⊏</span><span class='Modifier'>˘</span> <span class='Value'>a</span> <span class='Comment'># First column </span>"ace" <span class='Function'>⌽</span><span class='Modifier'>˘</span> <span class='Value'>a</span> <span class='Comment'># Swap the columns @@ -52,7 +52,7 @@ ┘ </pre> <p>In these three cases above, the results are the same as you would get from <a href="transpose.html">transposing</a> before and after (which does nothing to the rank-1 result of <code><span class='Function'>⊏</span><span class='Modifier'>˘</span></code>, but that's what's wanted). But in the following cases, the structure is quite different: <code><span class='Function'>↑</span><span class='Value'>a</span></code> is a list of matrices while <code><span class='Function'>↑</span><span class='Modifier'>˘</span><span class='Value'>a</span></code> is a matrix of lists. This is because the functions <code><span class='Function'>⊏</span></code>, <code><span class='Function'>⌽</span></code>, and <code><span class='Function'>⊣</span><span class='Modifier'>`</span></code> leave the trailing axis structure intact (<code><span class='Function'>⊏</span></code> removes one axis); taking into account that Rank or Cells always preserves the leading or frame axes, all axes are preserved (except the one removed by <code><span class='Function'>⊏</span></code>). But Prefixes or Suffixes move axes after the first from the whole of <code><span class='Value'>𝕩</span></code> to elements of the result, pushing them down in depth, and Rank won't undo this sort of structural change.</p> -<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=4oaRIGEgICAgICAgICAgICAgICAgICAgIyBQcmVmaXhlcyBvZiBhOiAgICByYW5rcyAxfDIKCuKGkcuYIGEgICAgICAgICAgICAgICAgICAjIFByZWZpeGVzIG9mIHJvd3M6IHJhbmtzIDJ8MQoK4oi+y50gYSAgICAgICAgICAgICAgICAgICMgSm9pbiB0aGUgY2VsbHMKCuKIvsudy5ggYSAgICAgICAgICAgICAgICAgIyBKb2luLWluc2VydCBpcyBhIG5vLW9wIG9uIGxpc3Rz">↗️</a><pre> <span class='Function'>↑</span> <span class='Value'>a</span> <span class='Comment'># Prefixes of a: ranks 1|2 +<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=4oqiIGEg4oaQIDPigL8yIOKliiAiYWJjZGVmIiAgIyBBbiBhcnJheSB3aXRoIHRocmVlIG1ham9yIGNlbGxzCuKGkSBhICAgICAgICAgICAgICAgICAgICMgUHJlZml4ZXMgb2YgYTogICAgcmFua3MgMXwyCgrihpHLmCBhICAgICAgICAgICAgICAgICAgIyBQcmVmaXhlcyBvZiByb3dzOiByYW5rcyAyfDEKCuKIvsudIGEgICAgICAgICAgICAgICAgICAjIEpvaW4gdGhlIGNlbGxzCgriiL7LncuYIGEgICAgICAgICAgICAgICAgICMgSm9pbi1pbnNlcnQgaXMgYSBuby1vcCBvbiBsaXN0cw==">↗️</a><pre> <span class='Function'>↑</span> <span class='Value'>a</span> <span class='Comment'># Prefixes of a: ranks 1|2 </span>┌─ · ↕0‿2 ┌─ ┌─ ┌─ ╵"ab" ╵"ab ╵"ab @@ -79,7 +79,7 @@ ┘ </pre> <p><a href="couple.html">Solo</a> (<code><span class='Function'>≍</span></code>), something of a maverick, manages to act on <em>zero</em> leading axes of <code><span class='Value'>𝕩</span></code> by creating the first axis of the <em>result</em> instead. Because it doesn't need any axis to work, it can go in front of either axis but also past the last one by working with rank 0, a case where most array functions would give an error.</p> -<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=4omiIOKJjSBhICAgICAgICAgICAgICAgICAjIFNvbG8gYWRkcyBhIGxlbmd0aC0xIGF4aXMKCmEg4omhIOKKjyDiiY0gYSAgICAgICAgICAgICAjIEZpcnN0IENlbGwgdW5kb2VzIHRoaXMKCuKJoiDiiY3LmCBhICAgICAgICAgICAgICAgICMgU29sbyBjYW4gaW5zZXJ0IHRoZSBheGlzIGRlZXBlcuKApgoK4omiIOKJjeKOiTAgYSAgICAgICAgICAgICAgICMg4oCmb3IgZGVlcGVyIHN0aWxsLg==">↗️</a><pre> <span class='Function'>≢</span> <span class='Function'>≍</span> <span class='Value'>a</span> <span class='Comment'># Solo adds a length-1 axis +<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=4oqiIGEg4oaQIDPigL8yIOKliiAiYWJjZGVmIiAgIyBBbiBhcnJheSB3aXRoIHRocmVlIG1ham9yIGNlbGxzCuKJoiDiiY0gYSAgICAgICAgICAgICAgICAgIyBTb2xvIGFkZHMgYSBsZW5ndGgtMSBheGlzCgphIOKJoSDiio8g4omNIGEgICAgICAgICAgICAgIyBGaXJzdCBDZWxsIHVuZG9lcyB0aGlzCgriiaIg4omNy5ggYSAgICAgICAgICAgICAgICAjIFNvbG8gY2FuIGluc2VydCB0aGUgYXhpcyBkZWVwZXLigKYKCuKJoiDiiY3ijokwIGEgICAgICAgICAgICAgICAjIOKApm9yIGRlZXBlciBzdGlsbC4=">↗️</a><pre> <span class='Function'>≢</span> <span class='Function'>≍</span> <span class='Value'>a</span> <span class='Comment'># Solo adds a length-1 axis </span>⟨ 1 3 2 ⟩ <span class='Value'>a</span> <span class='Function'>≡</span> <span class='Function'>⊏</span> <span class='Function'>≍</span> <span class='Value'>a</span> <span class='Comment'># First Cell undoes this @@ -187,7 +187,7 @@ ┘ </pre> <p>That's shape <code><span class='Number'>3</span><span class='Ligature'>‿</span><span class='Number'>2</span><span class='Ligature'>‿</span><span class='Number'>4</span></code> matched with shape <code><span class='Bracket'>⟨</span><span class='Number'>3</span><span class='Bracket'>⟩</span></code>: the leading <code><span class='Number'>3</span></code> agrees. Now to match with <code><span class='Number'>3</span><span class='Ligature'>‿</span><span class='Number'>2</span></code>:</p> -<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=4oqiIGMg4oaQIDEwMCDDlyAzID3ijJzil4vihpUgMiAgIyBBIHJhbmstMiBhcnJheSB0byBhZGQKCmMgKyB4ICAgICAgICAgICAgICAgICAjIDAtY2VsbHMgcGFpcmVkIHdpdGggMS1jZWxscw==">↗️</a><pre> <span class='Function'>⊢</span> <span class='Value'>c</span> <span class='Gets'>←</span> <span class='Number'>100</span> <span class='Function'>×</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'>2</span> <span class='Comment'># A rank-2 array to add +<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=4oqiIHgg4oaQIDPigL8y4oC/NCDipYog4oaVNjAgICAgICMgQSByYW5rLTMgYXJyYXkK4oqiIGMg4oaQIDEwMCDDlyAzID3ijJzil4vihpUgMiAgIyBBIHJhbmstMiBhcnJheSB0byBhZGQKCmMgKyB4ICAgICAgICAgICAgICAgICAjIDAtY2VsbHMgcGFpcmVkIHdpdGggMS1jZWxscw==">↗️</a><pre> <span class='Function'>⊢</span> <span class='Value'>c</span> <span class='Gets'>←</span> <span class='Number'>100</span> <span class='Function'>×</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'>2</span> <span class='Comment'># A rank-2 array to add </span>┌─ ╵ 100 0 0 100 @@ -207,7 +207,7 @@ ┘ </pre> <p>And of course, identical shapes agree:</p> -<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=eCArIHggICAgICAgICAgICAgICAgICMgUGFpcndpc2UgYWRkaXRpb24=">↗️</a><pre> <span class='Value'>x</span> <span class='Function'>+</span> <span class='Value'>x</span> <span class='Comment'># Pairwise addition +<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=4oqiIHgg4oaQIDPigL8y4oC/NCDipYog4oaVNjAgICAgICMgQSByYW5rLTMgYXJyYXkKeCArIHggICAgICAgICAgICAgICAgICMgUGFpcndpc2UgYWRkaXRpb24=">↗️</a><pre> <span class='Value'>x</span> <span class='Function'>+</span> <span class='Value'>x</span> <span class='Comment'># Pairwise addition </span>┌─ ╎ 0 2 4 6 8 10 12 14 |
