diff options
| author | Marshall Lochbaum <mwlochbaum@gmail.com> | 2021-08-11 17:21:31 -0400 |
|---|---|---|
| committer | Marshall Lochbaum <mwlochbaum@gmail.com> | 2021-08-11 17:25:04 -0400 |
| commit | 2afb23928e1984d475cc460e1672e8f6fa0e4dbe (patch) | |
| tree | ebd2cc514294d30b6fa4b36c2ee638326f06ef72 /docs/doc/take.html | |
| parent | eac61ca02074c218667754d5f4ef562e780bae85 (diff) | |
Allow clicking on header to get fragment link
Diffstat (limited to 'docs/doc/take.html')
| -rw-r--r-- | docs/doc/take.html | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/docs/doc/take.html b/docs/doc/take.html index 0dcbaa39..1dd895ff 100644 --- a/docs/doc/take.html +++ b/docs/doc/take.html @@ -4,7 +4,7 @@ <title>BQN: Take and Drop</title> </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="take-and-drop">Take and Drop</h1> +<h1 id="take-and-drop"><a class="header" href="#take-and-drop">Take and Drop</a></h1> <svg viewBox='-156.8 -64 672 204.8'> <g fill='currentColor' stroke-linecap='round' text-anchor='middle' font-family='BQN,monospace'> <rect class='code' stroke-width='1.5' rx='12' x='-100.8' y='-40' width='560' height='156.8'/> @@ -43,7 +43,7 @@ </ul> <p>These extensions can be combined as well, so there are a lot of possibilities. A good picture to have in mind is cutting out a corner of the array <code><span class='Value'>π©</span></code>. This is because the result <code><span class='Value'>π¨</span><span class='Function'>β</span><span class='Value'>π©</span></code> or <code><span class='Value'>π¨</span><span class='Function'>β</span><span class='Value'>π©</span></code> always aligns with one side of <code><span class='Value'>π©</span></code> along each axis, so it aligns with the corner where those sides meet.</p> <p>The result <code><span class='Value'>d</span><span class='Function'>β</span><span class='Value'>π©</span></code> is always the same as <code><span class='Value'>t</span><span class='Function'>β</span><span class='Value'>π©</span></code> for some other argument <code><span class='Value'>t</span></code>, but computing <code><span class='Value'>t</span></code> wouldn't be too convenient. The reverse isn't true: only Take can insert fills, so results that include them can't come from Drop.</p> -<h2 id="one-axis">One axis</h2> +<h2 id="one-axis"><a class="header" href="#one-axis">One axis</a></h2> <p>Let's start with a natural number <code><span class='Value'>π¨</span></code>. Take gives the first <code><span class='Value'>π¨</span></code> major cells of <code><span class='Value'>π©</span></code> (or elements of a list), while Drop gives all but the first <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=NCDihpEgInRha2UgYW5kIGRyb3AiCjQg4oaTICJ0YWtlIGFuZCBkcm9wIgoKMSDihpMgPiJtYWoi4oC/Im9yYyLigL8iZWxsIg==">βοΈ</a><pre> <span class='Number'>4</span> <span class='Function'>β</span> <span class='String'>"take and drop"</span> "take" @@ -76,7 +76,7 @@ <span class='Number'>3</span> <span class='Function'>β</span> <span class='Function'><</span><span class='String'>"element"</span> β¨β© </pre> -<h3 id="negative-argument">Negative argument</h3> +<h3 id="negative-argument"><a class="header" href="#negative-argument">Negative argument</a></h3> <p>If <code><span class='Value'>π¨</span></code> is negative then wraps around the other side to take or drop from the end of <code><span class='Value'>π©</span></code>. It's a lot like negative indices in <a href="select.html">Select</a> (<code><span class='Function'>β</span></code>), but while negative indices are asymmetricβ<code><span class='Number'>0</span></code> is the first entry but <code><span class='Number'>Β―1</span></code> is the lastβthis case is symmetric. It's because the place to cut is always <em>before</em> the index <code><span class='Value'>π¨</span></code>, cancelling out the negative index asymmetry.</p> <a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=MyDihpEgImFiY2RlRURDQkEiCgrCrzMg4oaRICJhYmNkZUVEQ0JBIiAgIyBMYXN0IHRocmVlCgrCrzMg4oaTICJhYmNkZUVEQ0JBIiAgIyBBbGwgYnV0IHRoZSBsYXN0IHRocmVl">βοΈ</a><pre> <span class='Number'>3</span> <span class='Function'>β</span> <span class='String'>"abcdeEDCBA"</span> "abc" @@ -98,7 +98,7 @@ <a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=wq82IOKGkSAieHki">βοΈ</a><pre> <span class='Number'>Β―6</span> <span class='Function'>β</span> <span class='String'>"xy"</span> " xy" </pre> -<h2 id="multiple-axes">Multiple axes</h2> +<h2 id="multiple-axes"><a class="header" href="#multiple-axes">Multiple axes</a></h2> <p>In the general case <code><span class='Value'>π¨</span></code> is a list of integers. They're matched with the leading axes of <code><span class='Value'>π©</span></code>, so that each affects one axis independently from the others.</p> <a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=4oqiIG0g4oaQICgxMMOX4oaVNSkgK+KMnCDihpU3CgrCrzTigL8yIOKGkSBtICAjIExhc3QgZm91ciByb3dzOyBmaXJzdCB0d28gY29sdW1ucwoKwq804oC/MiDihpMgbQ==">βοΈ</a><pre> <span class='Function'>β’</span> <span class='Value'>m</span> <span class='Gets'>β</span> <span class='Paren'>(</span><span class='Number'>10</span><span class='Function'>Γβ</span><span class='Number'>5</span><span class='Paren'>)</span> <span class='Function'>+</span><span class='Modifier'>β</span> <span class='Function'>β</span><span class='Number'>7</span> ββ |
