diff options
Diffstat (limited to 'docs/doc')
| -rw-r--r-- | docs/doc/couple.html | 2 | ||||
| -rw-r--r-- | docs/doc/replicate.html | 2 | ||||
| -rw-r--r-- | docs/doc/reverse.html | 2 | ||||
| -rw-r--r-- | docs/doc/shift.html | 2 |
4 files changed, 4 insertions, 4 deletions
diff --git a/docs/doc/couple.html b/docs/doc/couple.html index 1e55a233..164c0fd5 100644 --- a/docs/doc/couple.html +++ b/docs/doc/couple.html @@ -65,7 +65,7 @@ <span class='Function'>∾</span> <span class='Function'>⥊</span> <span class='Function'>⥊</span><span class='Modifier'>¨</span> <span class='Value'>a</span> "ABrstABuvwABxyzCDrstCDuvwCDxyz" </pre> -<p>The way this happens, and the constraint that all inner arrays have the same shape, is closely connected to the concept of an array, and like <a href="map.html#table">Table</a> <code><span class='Modifier'>⌜</span></code>, Merge might be considered a fundamental way to build up multidimensional arrays from lists. In both cases rank-0 or <a href="enclose.html#whats-a-unit">unit</a> arrays are somewhat special. They are the <a href="fold.html#identity-values">identity value</a> of a function with Table, and can be produced by Merge inverse, <code><span class='Function'>></span><span class='Modifier'>⁼</span></code> <strong>on a list</strong>, which forces either the outer or inner shape to be empty (BQN chooses <code><span class='Function'>></span><span class='Modifier'>⁼</span></code> to be <code><span class='Function'><</span></code>, but only on an array, as <code><span class='Function'>></span></code> cannot produce non-arrays). Merge has another catch as well: it cannot produce arrays with a <code><span class='Number'>0</span></code> in the shape, except at the end, unless fills can be specified.</p> +<p>The way this happens, and the constraint that all inner arrays have the same shape, is closely connected to the concept of an array, and like <a href="map.html#table">Table</a> <code><span class='Modifier'>⌜</span></code>, Merge might be considered a fundamental way to build up multidimensional arrays from lists. In both cases rank-0 or <a href="enclose.html#whats-a-unit">unit</a> arrays are somewhat special. They are the <a href="fold.html#identity-values">identity value</a> of a function with Table, and can be produced by Merge <a href="undo.html">inverse</a>, <code><span class='Function'>></span><span class='Modifier'>⁼</span></code> <strong>on a list</strong>, which forces either the outer or inner shape to be empty (BQN chooses <code><span class='Function'>></span><span class='Modifier'>⁼</span></code> to be <code><span class='Function'><</span></code>, but only on an array, as <code><span class='Function'>></span></code> cannot produce non-arrays). Merge has another catch as well: it cannot produce arrays with a <code><span class='Number'>0</span></code> in the shape, except at the end, unless fills can be specified.</p> <a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=4oqiIGUg4oaQIOKfqOKfqcKoIOKGlTMK4omiID4gZQriiaIgPiA+IGU=">↗️</a><pre> <span class='Function'>⊢</span> <span class='Value'>e</span> <span class='Gets'>←</span> <span class='Bracket'>⟨⟩</span><span class='Modifier'>¨</span> <span class='Function'>↕</span><span class='Number'>3</span> ⟨ ⟨⟩ ⟨⟩ ⟨⟩ ⟩ <span class='Function'>≢</span> <span class='Function'>></span> <span class='Value'>e</span> diff --git a/docs/doc/replicate.html b/docs/doc/replicate.html index 746062ea..31e76b28 100644 --- a/docs/doc/replicate.html +++ b/docs/doc/replicate.html @@ -213,7 +213,7 @@ </pre> <p>This means the transitions can be grouped exactly in pairs, the beginning and end of each group. Reshape with a <a href="reshape.html#computed-lengths">computed length</a> <code><span class='Modifier2'>∘</span><span class='Ligature'>‿</span><span class='Number'>2</span></code> groups these pairs, and then a scan <code><span class='Function'>-</span><span class='Modifier'>˜`˘</span></code> can be used to convert the start/end format to start/length if wanted.</p> <h3 id="inverse">Inverse</h3> -<p>The result of Indices <code><span class='Function'>/</span><span class='Value'>n</span></code> is an ordered list of natural numbers, where the number <code><span class='Value'>i</span></code> appears <code><span class='Value'>i</span><span class='Function'>⊑</span><span class='Value'>n</span></code> times. Given an ordered list of natural numbers <code><span class='Value'>k</span></code>, the <em>inverse</em> of indices returns a corresponding <code><span class='Value'>n</span></code>: one where the value <code><span class='Value'>i</span><span class='Function'>⊑</span><span class='Value'>n</span></code> is the number of times <code><span class='Value'>i</span></code> appears in <code><span class='Value'>k</span></code>.</p> +<p>The result of Indices <code><span class='Function'>/</span><span class='Value'>n</span></code> is an ordered list of natural numbers, where the number <code><span class='Value'>i</span></code> appears <code><span class='Value'>i</span><span class='Function'>⊑</span><span class='Value'>n</span></code> times. Given an ordered list of natural numbers <code><span class='Value'>k</span></code>, the <a href="undo.html"><em>inverse</em></a> of indices returns a corresponding <code><span class='Value'>n</span></code>: one where the value <code><span class='Value'>i</span><span class='Function'>⊑</span><span class='Value'>n</span></code> is the number of times <code><span class='Value'>i</span></code> appears in <code><span class='Value'>k</span></code>.</p> <a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=LyAz4oC/MuKAvzEKCi/igbwgMOKAvzDigL8w4oC/MeKAvzHigL8y">↗️</a><pre> <span class='Function'>/</span> <span class='Number'>3</span><span class='Ligature'>‿</span><span class='Number'>2</span><span class='Ligature'>‿</span><span class='Number'>1</span> ⟨ 0 0 0 1 1 2 ⟩ diff --git a/docs/doc/reverse.html b/docs/doc/reverse.html index 62eae902..4fc5165a 100644 --- a/docs/doc/reverse.html +++ b/docs/doc/reverse.html @@ -38,7 +38,7 @@ <span class='Function'>≍</span><span class='Modifier2'>○</span><span class='Function'><</span><span class='Modifier'>˜´</span> <span class='Function'>⌽</span> <span class='String'>"abcd"</span> <span class='Comment'># Left to right </span>⟨ ⟨ "ab" 'c' ⟩ 'd' ⟩ </pre> -<p>Reverse is its own inverse <code><span class='Function'>⌽</span><span class='Modifier'>⁼</span></code>. As a result, <code><span class='Function'>𝔽</span><span class='Modifier2'>⌾</span><span class='Function'>⌽</span></code> reverses the argument, applies <code><span class='Function'>𝔽</span></code>, and reverses again. It's a particularly useful pattern with <a href="scan.html">Scan</a>, as it allows scanning from the end rather than the beginning of the array. For example, <code><span class='Function'>∨</span><span class='Modifier'>`</span></code> on a list of booleans changes all bits after the first <code><span class='Number'>1</span></code> to <code><span class='Number'>1</span></code>, but <code><span class='Function'>∨</span><span class='Modifier'>`</span><span class='Modifier2'>⌾</span><span class='Function'>⌽</span></code> does this to all bits before the last <code><span class='Number'>1</span></code>.</p> +<p>Reverse is its own <a href="undo.html">inverse</a> <code><span class='Function'>⌽</span><span class='Modifier'>⁼</span></code>. As a result, <code><span class='Function'>𝔽</span><span class='Modifier2'>⌾</span><span class='Function'>⌽</span></code> reverses the argument, applies <code><span class='Function'>𝔽</span></code>, and reverses again. It's a particularly useful pattern with <a href="scan.html">Scan</a>, as it allows scanning from the end rather than the beginning of the array. For example, <code><span class='Function'>∨</span><span class='Modifier'>`</span></code> on a list of booleans changes all bits after the first <code><span class='Number'>1</span></code> to <code><span class='Number'>1</span></code>, but <code><span class='Function'>∨</span><span class='Modifier'>`</span><span class='Modifier2'>⌾</span><span class='Function'>⌽</span></code> does this to all bits before the last <code><span class='Number'>1</span></code>.</p> <a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=4oioYCAgIDDigL8w4oC/MeKAvzDigL8w4oC/MeKAvzAKCuKIqGDijL7ijL0gMOKAvzDigL8x4oC/MOKAvzDigL8x4oC/MA==">↗️</a><pre> <span class='Function'>∨</span><span class='Modifier'>`</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><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 0 1 1 1 1 1 ⟩ diff --git a/docs/doc/shift.html b/docs/doc/shift.html index a85fce92..ecee0d5c 100644 --- a/docs/doc/shift.html +++ b/docs/doc/shift.html @@ -20,7 +20,7 @@ </pre> <p>If <code><span class='Value'>𝕨</span></code> is longer than <code><span class='Value'>𝕩</span></code>, some cells from <code><span class='Value'>𝕨</span></code> will be discarded, as well as all of <code><span class='Value'>𝕩</span></code>. In this case <code><span class='Value'>𝕨</span><span class='Function'>»</span><span class='Value'>𝕩</span></code> is <code><span class='Paren'>(</span><span class='Function'>≠</span><span class='Value'>𝕩</span><span class='Paren'>)</span><span class='Function'>↑</span><span class='Value'>𝕨</span></code> and <code><span class='Value'>𝕨</span><span class='Function'>«</span><span class='Value'>𝕩</span></code> is <code><span class='Paren'>(</span><span class='Function'>-≠</span><span class='Value'>𝕩</span><span class='Paren'>)</span><span class='Function'>↑</span><span class='Value'>𝕨</span></code>. For similar reasons, nudging an array of length 0 returns it unchanged.</p> <h2 id="sequence-processing-with-shifts">Sequence processing with shifts</h2> -<p>When working with a sequence of data such as text, daily measurements, or audio data, shift functions are generally the best way to handle the concept of "next" or "previous". In the following example <code><span class='Value'>s</span></code> is shown alongside the shifted-right data <code><span class='Function'>»</span><span class='Value'>s</span></code>, and each element is compared to the previous with <code><span class='Function'>-</span><span class='Modifier2'>⟜</span><span class='Function'>»</span></code>, which we see is the inverse of Plus <a href="scan.html">Scan</a> <code><span class='Function'>+</span><span class='Modifier'>`</span></code>.</p> +<p>When working with a sequence of data such as text, daily measurements, or audio data, shift functions are generally the best way to handle the concept of "next" or "previous". In the following example <code><span class='Value'>s</span></code> is shown alongside the shifted-right data <code><span class='Function'>»</span><span class='Value'>s</span></code>, and each element is compared to the previous with <code><span class='Function'>-</span><span class='Modifier2'>⟜</span><span class='Function'>»</span></code>, which we see is the <a href="undo.html">inverse</a> of Plus <a href="scan.html">Scan</a> <code><span class='Function'>+</span><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=cyDihpAgMeKAvzLigL8y4oC/NOKAvzPigL814oC/NgpzIOKJjSDCu3MKLeKfnMK7IHMKCitgIC3in5zCuyBz">↗️</a><pre> <span class='Value'>s</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'>2</span><span class='Ligature'>‿</span><span class='Number'>4</span><span class='Ligature'>‿</span><span class='Number'>3</span><span class='Ligature'>‿</span><span class='Number'>5</span><span class='Ligature'>‿</span><span class='Number'>6</span> <span class='Value'>s</span> <span class='Function'>≍</span> <span class='Function'>»</span><span class='Value'>s</span> ┌─ |
