aboutsummaryrefslogtreecommitdiff
path: root/docs/doc/range.html
diff options
context:
space:
mode:
Diffstat (limited to 'docs/doc/range.html')
-rw-r--r--docs/doc/range.html14
1 files changed, 7 insertions, 7 deletions
diff --git a/docs/doc/range.html b/docs/doc/range.html
index 8065a34a..887f9833 100644
--- a/docs/doc/range.html
+++ b/docs/doc/range.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="range"><a class="header" href="#range">Range</a></h1>
-<p>Range (<code><span class='Function'>↕</span></code>) is a monadic function that creates arrays of <a href="indices.html">indices</a> (like APL's famous <a href="https://aplwiki.com/wiki/Index_Generator">iota</a> function). Each element in the result is its own index.</p>
+<p>Range (<code><span class='Function'>↕</span></code>) is a monadic function that creates arrays of indices, like APL's famous <a href="https://aplwiki.com/wiki/Index_Generator">iota</a> function <code><span class='Value'>⍳</span></code>. Each element in the result is its own <a href="indices.html">index</a>.</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=4oaVIDYKCuKGlSAy4oC/Mw==">↗️</a><pre> <span class='Function'>↕</span> <span class='Number'>6</span>
⟨ 0 1 2 3 4 5 ⟩
@@ -29,7 +29,7 @@
<span class='Paren'>(</span><span class='Function'>↕</span><span class='Bracket'>⟨</span><span class='Number'>6</span><span class='Bracket'>⟩</span><span class='Paren'>)</span> <span class='Function'>⊑</span> <span class='String'>&quot; pick &quot;</span>
" pick "
</pre>
-<p>They also correspond to Length (<code><span class='Function'>≠</span></code>) and <a href="shape.html">Shape</a> (<code><span class='Function'>≢</span></code>): for an array <code><span class='Value'>a</span></code>, <code><span class='Function'>↕≠</span><span class='Value'>a</span></code> gives the indices of major cells, while <code><span class='Function'>↕≢</span><span class='Value'>a</span></code> gives the indices of all elements.</p>
+<p>They also correspond to <a href="shape.html">Length</a> (<code><span class='Function'>≠</span></code>) <a href="shape.html">and Shape</a> (<code><span class='Function'>≢</span></code>): for an array <code><span class='Value'>a</span></code>, <code><span class='Function'>↕≠</span><span class='Value'>a</span></code> gives the indices of major cells, while <code><span class='Function'>↕≢</span><span class='Value'>a</span></code> gives the indices of all elements.</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=YSDihpAgNOKAvzLipYpACgrihpUg4omgIGEKCuKGlSDiiaIgYQ==">↗️</a><pre> <span class='Value'>a</span> <span class='Gets'>←</span> <span class='Number'>4</span><span class='Ligature'>‿</span><span class='Number'>2</span><span class='Function'>⥊</span><span class='String'>@</span>
<span class='Function'>↕</span> <span class='Function'>≠</span> <span class='Value'>a</span>
@@ -54,11 +54,11 @@
<span class='Number'>2</span> <span class='Function'>↓</span> <span class='Function'>↕</span><span class='Number'>4</span>
⟨ 2 3 ⟩
</pre>
-<p>The result of <code><span class='Function'>↕</span><span class='Value'>𝕩</span></code> is a list of length <code><span class='Value'>𝕩</span></code>, but doesn't include <code><span class='Value'>𝕩</span></code> itself. That's just how counting starting at 0 works. It does mean we can create a length-0 list easily:</p>
+<p>The result of <code><span class='Function'>↕</span><span class='Value'>𝕩</span></code> is a list of length <code><span class='Value'>𝕩</span></code>, but doesn't include <code><span class='Value'>𝕩</span></code> itself. That's just how counting starting at 0 works (but a nice trick if you do want to include <code><span class='Value'>𝕩</span></code> is <code><span class='Function'>↕</span><span class='Modifier2'>⊸</span><span class='Function'>∾</span><span class='Value'>𝕩</span></code>). It means we can create a length-0 list easily:</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=4oaVIDA=">↗️</a><pre> <span class='Function'>↕</span> <span class='Number'>0</span>
⟨⟩
</pre>
-<p>Like all other results of <code><span class='Function'>↕</span></code> on a number, <code><span class='Function'>↕</span><span class='Number'>0</span></code> has a fill of 0.</p>
+<p>As with any other number argument, <code><span class='Function'>↕</span><span class='Number'>0</span></code> has a <a href="fill.html">fill</a> of 0.</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=NCDihpEg4oaVMAoKNCDihpEg4oaVMw==">↗️</a><pre> <span class='Number'>4</span> <span class='Function'>↑</span> <span class='Function'>↕</span><span class='Number'>0</span>
⟨ 0 0 0 0 ⟩
@@ -72,7 +72,7 @@
<span class='Function'>»</span><span class='Modifier2'>⍟</span><span class='Number'>3</span> <span class='String'>'b'</span><span class='Function'>+↕</span><span class='Number'>8</span>
" bcdef"
</pre>
-<p>One interesting use of Range is to find, at each position in a boolean list, the most recent index that has a 1. To do this, first get the array of indices for <code><span class='Value'>b</span></code>, <code><span class='Function'>↕≠</span><span class='Value'>b</span></code>. Then multiply <code><span class='Value'>b</span></code>, reducing indices where a <code><span class='Number'>0</span></code> is found to 0.</p>
+<p>One interesting use of Range is to find, at each position in a boolean list, the most recent index that has a 1. To do this, first get the array of indices for <code><span class='Value'>b</span></code>, <code><span class='Function'>↕≠</span><span class='Value'>b</span></code>. Then multiply by <code><span class='Value'>b</span></code>, reducing indices where a <code><span class='Number'>0</span></code> is found to 0.</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=4oqiIGIg4oaQIDDigL8x4oC/MeKAvzDigL8w4oC/MOKAvzHigL8wCgpiIOKJjSDihpXiiaBiCgpiIMOXIOKGleKJoGI=">↗️</a><pre> <span class='Function'>⊢</span> <span class='Value'>b</span> <span class='Gets'>←</span> <span class='Number'>0</span><span class='Ligature'>‿</span><span class='Number'>1</span><span class='Ligature'>‿</span><span class='Number'>1</span><span class='Ligature'>‿</span><span class='Number'>0</span><span class='Ligature'>‿</span><span class='Number'>0</span><span class='Ligature'>‿</span><span class='Number'>0</span><span class='Ligature'>‿</span><span class='Number'>1</span><span class='Ligature'>‿</span><span class='Number'>0</span>
⟨ 0 1 1 0 0 0 1 0 ⟩
@@ -97,7 +97,7 @@
⟨ 0 2 3 3 3 3 7 7 ⟩
</pre>
<h2 id="list-range"><a class="header" href="#list-range">List range</a></h2>
-<p>When the argument is a list of numbers, the result is an array of lists.</p>
+<p>When <code><span class='Value'>𝕩</span></code> is a list of numbers, the result is an array of lists.</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=4oaVIDLigL8z4oC/NA==">↗️</a><pre> <span class='Function'>↕</span> <span class='Number'>2</span><span class='Ligature'>‿</span><span class='Number'>3</span><span class='Ligature'>‿</span><span class='Number'>4</span>
┌─
╎ ⟨ 0 0 0 ⟩ ⟨ 0 0 1 ⟩ ⟨ 0 0 2 ⟩ ⟨ 0 0 3 ⟩
@@ -109,7 +109,7 @@
⟨ 1 2 0 ⟩ ⟨ 1 2 1 ⟩ ⟨ 1 2 2 ⟩ ⟨ 1 2 3 ⟩
</pre>
-<p>This array, which contains all possible choices of one natural number less than each element of <code><span class='Value'>𝕩</span></code>, can also be produced using Range on numbers only, along with <a href="map.html#table">Table</a> (<code><span class='Modifier'>⌜</span></code>).</p>
+<p>This array, which contains all possible choices of a natural number below each element of <code><span class='Value'>𝕩</span></code>, can also be produced using Range on numbers only, along with <a href="map.html#table">Table</a> (<code><span class='Modifier'>⌜</span></code>).</p>
<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=KDzin6jin6kpIOKIvuKMnMK0IOKGlcKoIDLigL8z4oC/NA==">↗️</a><pre> <span class='Paren'>(</span><span class='Function'>&lt;</span><span class='Bracket'>⟨⟩</span><span class='Paren'>)</span> <span class='Function'>∾</span><span class='Modifier'>⌜´</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='Ligature'>‿</span><span class='Number'>4</span>
┌─
╎ ⟨ 0 0 0 ⟩ ⟨ 0 0 1 ⟩ ⟨ 0 0 2 ⟩ ⟨ 0 0 3 ⟩