diff options
| author | Marshall Lochbaum <mwlochbaum@gmail.com> | 2021-06-14 22:06:01 -0400 |
|---|---|---|
| committer | Marshall Lochbaum <mwlochbaum@gmail.com> | 2021-06-14 22:06:01 -0400 |
| commit | 7b81224a5929c919815eb0a770cac93fa1325174 (patch) | |
| tree | e2234d58df0c05771c48e90afe1dde27542e4ef3 | |
| parent | 4c1292ee8e27e59891a60c2f1bf3c326d4dba51f (diff) | |
Documentation for Indices and Replicate
| -rw-r--r-- | doc/README.md | 1 | ||||
| -rw-r--r-- | doc/primitive.md | 2 | ||||
| -rw-r--r-- | doc/replicate.md | 146 | ||||
| -rw-r--r-- | docs/doc/index.html | 1 | ||||
| -rw-r--r-- | docs/doc/primitive.html | 4 | ||||
| -rw-r--r-- | docs/doc/replicate.html | 233 |
6 files changed, 384 insertions, 3 deletions
diff --git a/doc/README.md b/doc/README.md index 4183bcd6..41af9fcb 100644 --- a/doc/README.md +++ b/doc/README.md @@ -37,6 +37,7 @@ Primitives: - [Fold and Insert](fold.md) (`´˝`) - [Group](group.md) (`⊔`) - [Identity functions](identity.md) (`⊢⊣`) +- [Indices and Replicate](replicate.md) (`/`) - [Join and Join To](join.md) (`∾`) - [Logical functions](logic.md) (`∧∨¬`) - [Match](match.md) (`≡≢`) diff --git a/doc/primitive.md b/doc/primitive.md index 2197d99e..6ed52c23 100644 --- a/doc/primitive.md +++ b/doc/primitive.md @@ -46,7 +46,7 @@ Functions that have significant differences from APL functions are marked with a | `«` | [Nudge Back](shift.md)* | [Shift After](shift.md)* | `⌽` | [Reverse](reverse.md) | [Rotate](reverse.md#rotate) | `⍉` | [Transpose](transpose.md)* | [Reorder axes](transpose.md)* -| `/` | [Indices](https://aplwiki.com/wiki/Indices) | [Replicate](https://aplwiki.com/wiki/Replicate) +| `/` | [Indices](replicate.md#indices) | [Replicate](replicate.md) | `⍋` | [Grade Up](order.md#grade) | [Bins Up](order.md#bins) | `⍒` | [Grade Down](order.md#grade) | [Bins Down](order.md#bins) | `⊏` | First Cell* | Select* diff --git a/doc/replicate.md b/doc/replicate.md new file mode 100644 index 00000000..106a36e5 --- /dev/null +++ b/doc/replicate.md @@ -0,0 +1,146 @@ +*View this file with results and syntax highlighting [here](https://mlochbaum.github.io/BQN/doc/replicate.html).* + +# Indices and Replicate + +<!--GEN +d ← 48‿22 + +rc ← At "class=code|stroke-width=1.5|rx=12" +Ge ← "g"⊸At⊸Enc +g ← "font-family=BQN,monospace|font-size=18px|text-anchor=middle" +hg ← "class=bluegreen|stroke-width=0|opacity=0.2" +cg ← "font-size=24px|text-anchor=end" +lg ← "stroke-linecap=round|stroke=currentColor|opacity=0.7" + +wv ← 0‿1‿1‿0‿3‿2‿0‿0‿0 +xl ← ≠ xc ← ⊐ xt ← '''(Highlight∾∾⊣)¨"replicate" + +Text ← ("text" Attr "dy"‿"0.29em"∾(Pos d⊸×))⊸Enc +Line ← "line" Elt ("xy"≍⌜"12")≍˘○⥊ ·FmtNum d×⊢ +Rp ← Pos⊸∾⟜("width"‿"height"≍˘FmtNum)○(d⊸×) + +tx ← ↕xl ⋄ y ← » yd ← +`0.6+1‿2‿1‿1.8 +dim ← ⟨2+xl,¯1⊑yd⟩ ⋄ sh ← ¯2.1‿¯1.3 +tp ← y ≍˜¨¨ 2 / ⟨tx,↕+´wv⟩ +hp ← 0.2‿¯0.7(+⟜(1‿0×sh)≍¯2⊸×⊸+)1‿0×dim +Ll ← Line∘⍉ ≍ + (0≍0.05×-○⊑)≍˘0.45‿¯0.55˙ + +((∾˜d)×((-∾+˜)0.7‿0.4)+sh∾dim) SVG g Ge ⟨ + "rect" Elt rc ∾ sh Rp dim + hg Ge ("rect" Elt ·Rp˝ {𝕩⊸+⌾(1⊑⊏)hp})¨ 0‿2⊏y + cg Ge (¯0.7≍¨y) Text⟜Highlight¨ "𝕨"‿"𝕩"‿"𝕨/𝕩"‿"/𝕨" + tp Text¨○∾ Highlight∘•Repr¨¨⌾(1‿3⊸⊏) xt‿wv‿(wv/xt)‿(/wv) + lg Ge ⟨ + "stroke-width=0.4" Ge Ll¨ ´ (0=wv)⊸/¨ 2⊸↑ tp + "stroke-width=1.5" Ge > Ll¨¨˝˘ 2↕ wv⊸/¨⌾(2⊸↑)tp + ⟩ +⟩ +--> + +The functions Indices and Replicate are used to copy or filter data. They might be described as transforming a [run-length encoding](https://en.wikipedia.org/wiki/Run-length_encoding) into unencoded form. On the other hand, Indices might be described as giving a sparse representation of `𝕩`, which is smaller if `𝕩` mostly consists of zeros. + +BQN doesn't have any of the various features used in APL to add fills to the result of Replicate, like negative numbers in `𝕨` or an Expand (`\`) primitive. An alternative to Expand is to use Replicate with structural Under (`⌾`) to insert values into an array of fills. + +## Replicate + +Given a list of natural numbers `𝕨`, Replicate repeats each major cell in `𝕩` the corresponding number of times. That is, `𝕨` and `𝕩` must have the same length, and the result includes `i⊑𝕨` copies of each cell `i⊏𝕩`, in order. + + 2‿1‿0‿2 / "abcd" + + ⊢ a ← >"aa0"‿"bb1"‿"cc2"‿"dd3" + + 2‿1‿0‿2 / a + +It's also allowed for `𝕨` to be a single number (or enclosed number: it just needs to be a unit and not a list). In this case every cell of `𝕩` is repeated that number of times. + + 3 / "copy" + +When `𝕨` is a list of booleans, a cell is never repeated more than once, meaning that each cell of `𝕩` is either left out (0), or kept in (1). If `Fn` is a function with a boolean result, `Fn¨⊸/` filters elements of a list according to `Fn`. + + 1‿1‿0‿0‿1‿0 / "filter" + + ≤⟜'i' "filter" + + ≤⟜'i'⊸/ "filter" + +Here `≤⟜'i'` is a pervasive function, so there's no need to add `¨`. Similarly, to filter major cells of an array, `Fn˘⊸/` could be used, applying `Fn` to one major cell at a time. + +A similar pattern applies to Replicate as well. The function below tests which input characters are double quotes, but by adding one it changes the result to 1 for each non-quote character and 2 for quotes (but source code and display also double quotes here, so the input string has only two `"`s and the output has four). + + {1+'"'=𝕩}⊸/ "for ""escaping"" quotes" + +### Compound Replicate + +If `𝕨` has [depth](depth.md) two, then its elements give the amounts to copy along each [leading axis](leading.md) of `𝕩`. + + ⊢ b ← 2‿5 ⥊ ↕10 + + ⟨2‿0, 1‿0‿0‿1‿1⟩ / b + + 2‿0 / 1‿0‿0‿1‿1⊸/˘ b + +Here the `2‿0` indicates that the first row of `b` is copied twice and the second is ignored, while `1‿0‿0‿1‿1` picks out three entries from that row. `𝕩` can also have more axes than elements of `𝕨`, and the trailing ones aren't changed, just like the simpler case. However, `𝕨` has to have at least as many elements as `𝕩` has axes (so `(≠𝕨)≥=𝕩`), and each element has to have the same length as the corresponding axis in `𝕩`—or it can be a unit, as shown below. + + ⟨<2,<3⟩ / b + +Above, both elements of `𝕨` are enclosed numbers. An individual element doesn't have to be enclosed, but I don't recommend this, since if *none* of them are enclosed, then `𝕨` will have depth 1 and it will be interpreted as replicating along the first axis only. + + ⟨2,3⟩ / b + +The example above has a different result from the previous one! The function `<¨⊸/` could be used in place of `/` to replicate each axis by a different number. + +If `𝕨` is `⟨⟩`, then it has depth 1, but is handled with the multidimensional case anyway, giving a result of `𝕩`. The one-dimensional case could also only ever return `𝕩`, but it would be required to have length 0, so this convention still only extends the simple case. + + b ≡ ⟨⟩ / b + +## Indices + +The monadic form of `/` is much simpler than the dyadic one, with no multidimensional case or mismatched argument ranks. `𝕩` must be a list of natural numbers, and `/𝕩` is the list `𝕩/↕≠𝕩`. Its elements are the indices for `𝕩`, with index `i` repeated `i⊑𝕩` times. + + / 3‿0‿1‿2 + +A unit argument isn't allowed, and isn't very useful: for example, `/6` might indicate an array of six zeros, but this can be written `/⥊6` or `6⥊0` with hardly any extra effort. + +When `𝕨` has rank 1, `𝕨/𝕩` is equivalent to `𝕨/⊸⊏𝕩`. Of course, this isn't the only use of Indices. It also gets along well with [Group](group.md): for example, `/⊸⊔` groups `𝕩` according to a list of lengths `𝕨`. + + 2‿5‿0‿1 /⊸⊔ "ABCDEFGH" + +This function will fail to include trailing empty arrays; the modification `(/∾⟜1)⊸⊔` fixes this and ensures the result always has as many elements as `𝕨`. + +If `𝕩` is boolean then `/𝕩` contains all the indices where a 1 appears in `𝕩`. Applying `-⟜»` to the result gives the distance from each 1 to the previous, or to the start of the list, another potentially useful function. + + / 0‿1‿0‿1‿0‿0‿0‿0‿1‿0 + + -⟜» / 0‿1‿0‿1‿0‿0‿0‿0‿1‿0 + +With more effort we can also use `/` to analyze groups of 1s in the argument (and of course all these methods can be applied to 0s instead, by first flipping the values with `¬`). First we highlight the start and end of each group by comparing the list with a shifted copy of itself. Or rather, we'll first place a 0 at the front and then at the end, in order to detect when a group starts at the beginning of the list or ends at the end (there's also a [shift](shift.md)-based version, `≠⟜«0∾𝕩`). + + 0 (∾≍∾˜) 0‿1‿1‿1‿0‿0‿1‿0‿1‿1‿0 + + 0 (∾≠∾˜) 0‿1‿1‿1‿0‿0‿1‿0‿1‿1‿0 + + / 0(∾≠∾˜) 0‿1‿1‿1‿0‿0‿1‿0‿1‿1‿0 + +So now we have the indices of each transition from 0 to 1 or 1 to 0, in an extended list with 0 added at the beginning and end. The first index has to be for a 0 to 1 transition, because we forced the first value to be a 0, and then the next can only be 1 to 0, then 0 to 1, and so on until the last, which must be 1 to 0 because the last value is also 0. + + -˜`˘ ∘‿2⥊/ 0(∾≠∾˜) 0‿1‿1‿1‿0‿0‿1‿0‿1‿1‿0 + +This means the transitions can be grouped exactly in pairs, the beginning and end of each group. Reshape with a [computed length](reshape.md#computed-lengths) `∘‿2` groups these pairs, and then a scan ``-˜`˘`` can be used to convert the start/end format to start/length if wanted. + +### Inverse + +The result of Indices `/n` is an ordered list of natural numbers, where the number `i` appears `i⊑n` times. Given an ordered list of natural numbers `k`, the *inverse* of indices returns a corresponding `n`: one where the value `i⊑n` is the number of times `i` appears in `k`. + + / 3‿2‿1 + + /⁼ 0‿0‿0‿1‿1‿2 + +Finding how many times each index appears in a list of indices is often a useful thing to do, and there are a few ways to do it: + + +˝˘ (↕5) =⌜ 2‿2‿4‿1‿2‿0 # Inefficient + + ≠¨⊔ 2‿2‿4‿1‿2‿0 + + /⁼∧ 2‿2‿4‿1‿2‿0 + +For `/⁼` to work, the argument has to be sorted: otherwise it won't be a valid result of `/`. But sorting with `∧` is no problem, and `/⁼∧` will probably be faster than `≠¨⊔` in the absence of special handling for either combination. diff --git a/docs/doc/index.html b/docs/doc/index.html index 0f114bed..6d0a3dad 100644 --- a/docs/doc/index.html +++ b/docs/doc/index.html @@ -43,6 +43,7 @@ <li><a href="fold.html">Fold and Insert</a> (<code><span class='Modifier'>´˝</span></code>)</li> <li><a href="group.html">Group</a> (<code><span class='Function'>⊔</span></code>)</li> <li><a href="identity.html">Identity functions</a> (<code><span class='Function'>⊢⊣</span></code>)</li> +<li><a href="replicate.html">Indices and Replicate</a> (<code><span class='Function'>/</span></code>)</li> <li><a href="join.html">Join and Join To</a> (<code><span class='Function'>∾</span></code>)</li> <li><a href="logic.html">Logical functions</a> (<code><span class='Function'>∧∨¬</span></code>)</li> <li><a href="match.html">Match</a> (<code><span class='Function'>≡≢</span></code>)</li> diff --git a/docs/doc/primitive.html b/docs/doc/primitive.html index 618769e9..79792f24 100644 --- a/docs/doc/primitive.html +++ b/docs/doc/primitive.html @@ -181,8 +181,8 @@ </tr> <tr> <td><code><span class='Function'>/</span></code></td> -<td><a href="https://aplwiki.com/wiki/Indices">Indices</a></td> -<td><a href="https://aplwiki.com/wiki/Replicate">Replicate</a></td> +<td><a href="replicate.html#indices">Indices</a></td> +<td><a href="replicate.html">Replicate</a></td> </tr> <tr> <td><code><span class='Function'>⍋</span></code></td> diff --git a/docs/doc/replicate.html b/docs/doc/replicate.html new file mode 100644 index 00000000..752fc7e1 --- /dev/null +++ b/docs/doc/replicate.html @@ -0,0 +1,233 @@ +<head> + <link href="../favicon.ico" rel="shortcut icon" type="image/x-icon"/> + <link href="../style.css" rel="stylesheet"/> + <title>BQN: Indices and Replicate</title> +</head> +<div class="nav"><a href="https://github.com/mlochbaum/BQN">BQN</a> / <a href="../index.html">main</a> / <a href="index.html">doc</a></div> +<h1 id="indices-and-replicate">Indices and Replicate</h1> +<svg viewBox='-134.4 -37.4 595.2 198'> + <g font-family='BQN,monospace' font-size='18px' text-anchor='middle'> + <rect class='code' stroke-width='1.5' rx='12' x='-100.8' y='-28.6' width='528' height='180.4'/> + <g class='bluegreen' stroke-width='0' opacity='0.2'> + <rect x='-91.2' y='-15.4' width='508.8' height='30.8'/> + <rect x='-91.2' y='77' width='508.8' height='30.8'/> + </g> + <g font-size='24px' text-anchor='end'> + <text dy='0.29em' x='-33.6' y='0'><tspan class='Value'>𝕨</tspan></text> + <text dy='0.29em' x='-33.6' y='35.2'><tspan class='Value'>𝕩</tspan></text> + <text dy='0.29em' x='-33.6' y='92.4'><tspan class='Value'>𝕨</tspan><tspan class='Function'>/</tspan><tspan class='Value'>𝕩</tspan></text> + <text dy='0.29em' x='-33.6' y='127.6'><tspan class='Function'>/</tspan><tspan class='Value'>𝕨</tspan></text> + </g> + <text dy='0.29em' x='0' y='0'><tspan class='String'>'r'</tspan></text> + <text dy='0.29em' x='48' y='0'><tspan class='String'>'e'</tspan></text> + <text dy='0.29em' x='96' y='0'><tspan class='String'>'p'</tspan></text> + <text dy='0.29em' x='144' y='0'><tspan class='String'>'l'</tspan></text> + <text dy='0.29em' x='192' y='0'><tspan class='String'>'i'</tspan></text> + <text dy='0.29em' x='240' y='0'><tspan class='String'>'c'</tspan></text> + <text dy='0.29em' x='288' y='0'><tspan class='String'>'a'</tspan></text> + <text dy='0.29em' x='336' y='0'><tspan class='String'>'t'</tspan></text> + <text dy='0.29em' x='384' y='0'><tspan class='String'>'e'</tspan></text> + <text dy='0.29em' x='0' y='35.2'><tspan class='Number'>0</tspan></text> + <text dy='0.29em' x='48' y='35.2'><tspan class='Number'>1</tspan></text> + <text dy='0.29em' x='96' y='35.2'><tspan class='Number'>1</tspan></text> + <text dy='0.29em' x='144' y='35.2'><tspan class='Number'>0</tspan></text> + <text dy='0.29em' x='192' y='35.2'><tspan class='Number'>3</tspan></text> + <text dy='0.29em' x='240' y='35.2'><tspan class='Number'>2</tspan></text> + <text dy='0.29em' x='288' y='35.2'><tspan class='Number'>0</tspan></text> + <text dy='0.29em' x='336' y='35.2'><tspan class='Number'>0</tspan></text> + <text dy='0.29em' x='384' y='35.2'><tspan class='Number'>0</tspan></text> + <text dy='0.29em' x='0' y='92.4'><tspan class='String'>'e'</tspan></text> + <text dy='0.29em' x='48' y='92.4'><tspan class='String'>'p'</tspan></text> + <text dy='0.29em' x='96' y='92.4'><tspan class='String'>'i'</tspan></text> + <text dy='0.29em' x='144' y='92.4'><tspan class='String'>'i'</tspan></text> + <text dy='0.29em' x='192' y='92.4'><tspan class='String'>'i'</tspan></text> + <text dy='0.29em' x='240' y='92.4'><tspan class='String'>'c'</tspan></text> + <text dy='0.29em' x='288' y='92.4'><tspan class='String'>'c'</tspan></text> + <text dy='0.29em' x='0' y='127.6'><tspan class='Number'>1</tspan></text> + <text dy='0.29em' x='48' y='127.6'><tspan class='Number'>2</tspan></text> + <text dy='0.29em' x='96' y='127.6'><tspan class='Number'>4</tspan></text> + <text dy='0.29em' x='144' y='127.6'><tspan class='Number'>4</tspan></text> + <text dy='0.29em' x='192' y='127.6'><tspan class='Number'>4</tspan></text> + <text dy='0.29em' x='240' y='127.6'><tspan class='Number'>5</tspan></text> + <text dy='0.29em' x='288' y='127.6'><tspan class='Number'>5</tspan></text> + <g stroke-linecap='round' stroke='currentColor' opacity='0.7'> + <g stroke-width='0.4'> + <line x1='0' x2='0' y1='9.9' y2='23.1'/> + <line x1='144' x2='144' y1='9.9' y2='23.1'/> + <line x1='288' x2='288' y1='9.9' y2='23.1'/> + <line x1='336' x2='336' y1='9.9' y2='23.1'/> + <line x1='384' x2='384' y1='9.9' y2='23.1'/> + </g> + <g stroke-width='1.5'> + <line x1='48' x2='48' y1='9.9' y2='23.1'/> + <line x1='96' x2='96' y1='9.9' y2='23.1'/> + <line x1='192' x2='192' y1='9.9' y2='23.1'/> + <line x1='192' x2='192' y1='9.9' y2='23.1'/> + <line x1='192' x2='192' y1='9.9' y2='23.1'/> + <line x1='240' x2='240' y1='9.9' y2='23.1'/> + <line x1='240' x2='240' y1='9.9' y2='23.1'/> + <line x1='48' x2='2.4' y1='45.1' y2='80.3'/> + <line x1='96' x2='50.4' y1='45.1' y2='80.3'/> + <line x1='192' x2='100.8' y1='45.1' y2='80.3'/> + <line x1='192' x2='146.4' y1='45.1' y2='80.3'/> + <line x1='192' x2='192' y1='45.1' y2='80.3'/> + <line x1='240' x2='240' y1='45.1' y2='80.3'/> + <line x1='240' x2='285.6' y1='45.1' y2='80.3'/> + <line x1='0' x2='0' y1='102.3' y2='115.5'/> + <line x1='48' x2='48' y1='102.3' y2='115.5'/> + <line x1='96' x2='96' y1='102.3' y2='115.5'/> + <line x1='144' x2='144' y1='102.3' y2='115.5'/> + <line x1='192' x2='192' y1='102.3' y2='115.5'/> + <line x1='240' x2='240' y1='102.3' y2='115.5'/> + <line x1='288' x2='288' y1='102.3' y2='115.5'/> + </g> + </g> + </g> +</svg> + +<p>The functions Indices and Replicate are used to copy or filter data. They might be described as transforming a <a href="https://en.wikipedia.org/wiki/Run-length_encoding">run-length encoding</a> into unencoded form. On the other hand, Indices might be described as giving a sparse representation of <code><span class='Value'>𝕩</span></code>, which is smaller if <code><span class='Value'>𝕩</span></code> mostly consists of zeros.</p> +<p>BQN doesn't have any of the various features used in APL to add fills to the result of Replicate, like negative numbers in <code><span class='Value'>𝕨</span></code> or an Expand (<code><span class='Value'>\</span></code>) primitive. An alternative to Expand is to use Replicate with structural Under (<code><span class='Modifier2'>⌾</span></code>) to insert values into an array of fills.</p> +<h2 id="replicate">Replicate</h2> +<p>Given a list of natural numbers <code><span class='Value'>𝕨</span></code>, Replicate repeats each major cell in <code><span class='Value'>𝕩</span></code> the corresponding number of times. That is, <code><span class='Value'>𝕨</span></code> and <code><span class='Value'>𝕩</span></code> must have the same length, and the result includes <code><span class='Value'>i</span><span class='Function'>⊑</span><span class='Value'>𝕨</span></code> copies of each cell <code><span class='Value'>i</span><span class='Function'>⊏</span><span class='Value'>𝕩</span></code>, in order.</p> +<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=MuKAvzHigL8w4oC/MiAvICJhYmNkIgoK4oqiIGEg4oaQID4iYWEwIuKAvyJiYjEi4oC/ImNjMiLigL8iZGQzIgoKMuKAvzHigL8w4oC/MiAvIGE=">↗️</a><pre> <span class='Number'>2</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'>2</span> <span class='Function'>/</span> <span class='String'>"abcd"</span> +"aabdd" + + <span class='Function'>⊢</span> <span class='Value'>a</span> <span class='Gets'>←</span> <span class='Function'>></span><span class='String'>"aa0"</span><span class='Ligature'>‿</span><span class='String'>"bb1"</span><span class='Ligature'>‿</span><span class='String'>"cc2"</span><span class='Ligature'>‿</span><span class='String'>"dd3"</span> +┌─ +╵"aa0 + bb1 + cc2 + dd3" + ┘ + + <span class='Number'>2</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'>2</span> <span class='Function'>/</span> <span class='Value'>a</span> +┌─ +╵"aa0 + aa0 + bb1 + dd3 + dd3" + ┘ +</pre> +<p>It's also allowed for <code><span class='Value'>𝕨</span></code> to be a single number (or enclosed number: it just needs to be a unit and not a list). In this case every cell of <code><span class='Value'>𝕩</span></code> is repeated that number of times.</p> +<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=MyAvICJjb3B5Ig==">↗️</a><pre> <span class='Number'>3</span> <span class='Function'>/</span> <span class='String'>"copy"</span> +"cccooopppyyy" +</pre> +<p>When <code><span class='Value'>𝕨</span></code> is a list of booleans, a cell is never repeated more than once, meaning that each cell of <code><span class='Value'>𝕩</span></code> is either left out (0), or kept in (1). If <code><span class='Function'>Fn</span></code> is a function with a boolean result, <code><span class='Function'>Fn</span><span class='Modifier'>¨</span><span class='Modifier2'>⊸</span><span class='Function'>/</span></code> filters elements of a list according to <code><span class='Function'>Fn</span></code>.</p> +<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=MeKAvzHigL8w4oC/MOKAvzHigL8wIC8gImZpbHRlciIKCuKJpOKfnCdpJyAiZmlsdGVyIgoK4omk4p+cJ2kn4oq4LyAiZmlsdGVyIg==">↗️</a><pre> <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'>1</span><span class='Ligature'>‿</span><span class='Number'>0</span> <span class='Function'>/</span> <span class='String'>"filter"</span> +"fie" + + <span class='Function'>≤</span><span class='Modifier2'>⟜</span><span class='String'>'i'</span> <span class='String'>"filter"</span> +⟨ 1 1 0 0 1 0 ⟩ + + <span class='Function'>≤</span><span class='Modifier2'>⟜</span><span class='String'>'i'</span><span class='Modifier2'>⊸</span><span class='Function'>/</span> <span class='String'>"filter"</span> +"fie" +</pre> +<p>Here <code><span class='Function'>≤</span><span class='Modifier2'>⟜</span><span class='String'>'i'</span></code> is a pervasive function, so there's no need to add <code><span class='Modifier'>¨</span></code>. Similarly, to filter major cells of an array, <code><span class='Function'>Fn</span><span class='Modifier'>˘</span><span class='Modifier2'>⊸</span><span class='Function'>/</span></code> could be used, applying <code><span class='Function'>Fn</span></code> to one major cell at a time.</p> +<p>A similar pattern applies to Replicate as well. The function below tests which input characters are double quotes, but by adding one it changes the result to 1 for each non-quote character and 2 for quotes (but source code and display also double quotes here, so the input string has only two <code><span class='String'>"</span></code>s and the output has four).</p> +<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=ezErJyInPfCdlal94oq4LyAiZm9yICIiZXNjYXBpbmciIiBxdW90ZXMi">↗️</a><pre> <span class='Brace'>{</span><span class='Number'>1</span><span class='Function'>+</span><span class='String'>'"'</span><span class='Function'>=</span><span class='Value'>𝕩</span><span class='Brace'>}</span><span class='Modifier2'>⊸</span><span class='Function'>/</span> <span class='String'>"for ""escaping"" quotes"</span> +"for """"escaping"""" quotes" +</pre> +<h3 id="compound-replicate">Compound Replicate</h3> +<p>If <code><span class='Value'>𝕨</span></code> has <a href="depth.html">depth</a> two, then its elements give the amounts to copy along each <a href="leading.html">leading axis</a> of <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=4oqiIGIg4oaQIDLigL81IOKliiDihpUxMAoK4p+oMuKAvzAsIDHigL8w4oC/MOKAvzHigL8x4p+pIC8gYgoKMuKAvzAgLyAx4oC/MOKAvzDigL8x4oC/MeKKuC/LmCBi">↗️</a><pre> <span class='Function'>⊢</span> <span class='Value'>b</span> <span class='Gets'>←</span> <span class='Number'>2</span><span class='Ligature'>‿</span><span class='Number'>5</span> <span class='Function'>⥊</span> <span class='Function'>↕</span><span class='Number'>10</span> +┌─ +╵ 0 1 2 3 4 + 5 6 7 8 9 + ┘ + + <span class='Bracket'>⟨</span><span class='Number'>2</span><span class='Ligature'>‿</span><span class='Number'>0</span><span class='Separator'>,</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'>1</span><span class='Bracket'>⟩</span> <span class='Function'>/</span> <span class='Value'>b</span> +┌─ +╵ 0 3 4 + 0 3 4 + ┘ + + <span class='Number'>2</span><span class='Ligature'>‿</span><span class='Number'>0</span> <span class='Function'>/</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'>1</span><span class='Modifier2'>⊸</span><span class='Function'>/</span><span class='Modifier'>˘</span> <span class='Value'>b</span> +┌─ +╵ 0 3 4 + 0 3 4 + ┘ +</pre> +<p>Here the <code><span class='Number'>2</span><span class='Ligature'>‿</span><span class='Number'>0</span></code> indicates that the first row of <code><span class='Value'>b</span></code> is copied twice and the second is ignored, while <code><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'>1</span></code> picks out three entries from that row. <code><span class='Value'>𝕩</span></code> can also have more axes than elements of <code><span class='Value'>𝕨</span></code>, and the trailing ones aren't changed, just like the simpler case. However, <code><span class='Value'>𝕨</span></code> has to have at least as many elements as <code><span class='Value'>𝕩</span></code> has axes (so <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 each element has to have the same length as the corresponding axis in <code><span class='Value'>𝕩</span></code>—or it can be a unit, as shown below.</p> +<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=4p+oPDIsPDPin6kgLyBi">↗️</a><pre> <span class='Bracket'>⟨</span><span class='Function'><</span><span class='Number'>2</span><span class='Separator'>,</span><span class='Function'><</span><span class='Number'>3</span><span class='Bracket'>⟩</span> <span class='Function'>/</span> <span class='Value'>b</span> +┌─ +╵ 0 0 0 1 1 1 2 2 2 3 3 3 4 4 4 + 0 0 0 1 1 1 2 2 2 3 3 3 4 4 4 + 5 5 5 6 6 6 7 7 7 8 8 8 9 9 9 + 5 5 5 6 6 6 7 7 7 8 8 8 9 9 9 + ┘ +</pre> +<p>Above, both elements of <code><span class='Value'>𝕨</span></code> are enclosed numbers. An individual element doesn't have to be enclosed, but I don't recommend this, since if <em>none</em> of them are enclosed, then <code><span class='Value'>𝕨</span></code> will have depth 1 and it will be interpreted as replicating along the first axis only.</p> +<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=4p+oMiwz4p+pIC8gYg==">↗️</a><pre> <span class='Bracket'>⟨</span><span class='Number'>2</span><span class='Separator'>,</span><span class='Number'>3</span><span class='Bracket'>⟩</span> <span class='Function'>/</span> <span class='Value'>b</span> +┌─ +╵ 0 1 2 3 4 + 0 1 2 3 4 + 5 6 7 8 9 + 5 6 7 8 9 + 5 6 7 8 9 + ┘ +</pre> +<p>The example above has a different result from the previous one! The function <code><span class='Function'><</span><span class='Modifier'>¨</span><span class='Modifier2'>⊸</span><span class='Function'>/</span></code> could be used in place of <code><span class='Function'>/</span></code> to replicate each axis by a different number.</p> +<p>If <code><span class='Value'>𝕨</span></code> is <code><span class='Bracket'>⟨⟩</span></code>, then it has depth 1, but is handled with the multidimensional case anyway, giving a result of <code><span class='Value'>𝕩</span></code>. The one-dimensional case could also only ever return <code><span class='Value'>𝕩</span></code>, but it would be required to have length 0, so this convention still only extends the simple case.</p> +<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=YiDiiaEg4p+o4p+pIC8gYg==">↗️</a><pre> <span class='Value'>b</span> <span class='Function'>≡</span> <span class='Bracket'>⟨⟩</span> <span class='Function'>/</span> <span class='Value'>b</span> +1 +</pre> +<h2 id="indices">Indices</h2> +<p>The monadic form of <code><span class='Function'>/</span></code> is much simpler than the dyadic one, with no multidimensional case or mismatched argument ranks. <code><span class='Value'>𝕩</span></code> must be a list of natural numbers, and <code><span class='Function'>/</span><span class='Value'>𝕩</span></code> is the list <code><span class='Value'>𝕩</span><span class='Function'>/↕≠</span><span class='Value'>𝕩</span></code>. Its elements are the indices for <code><span class='Value'>𝕩</span></code>, with index <code><span class='Value'>i</span></code> repeated <code><span class='Value'>i</span><span class='Function'>⊑</span><span class='Value'>𝕩</span></code> times.</p> +<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=LyAz4oC/MOKAvzHigL8y">↗️</a><pre> <span class='Function'>/</span> <span class='Number'>3</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'>2</span> +⟨ 0 0 0 2 3 3 ⟩ +</pre> +<p>A unit argument isn't allowed, and isn't very useful: for example, <code><span class='Function'>/</span><span class='Number'>6</span></code> might indicate an array of six zeros, but this can be written <code><span class='Function'>/⥊</span><span class='Number'>6</span></code> or <code><span class='Number'>6</span><span class='Function'>⥊</span><span class='Number'>0</span></code> with hardly any extra effort.</p> +<p>When <code><span class='Value'>𝕨</span></code> has rank 1, <code><span class='Value'>𝕨</span><span class='Function'>/</span><span class='Value'>𝕩</span></code> is equivalent to <code><span class='Value'>𝕨</span><span class='Function'>/</span><span class='Modifier2'>⊸</span><span class='Function'>⊏</span><span class='Value'>𝕩</span></code>. Of course, this isn't the only use of Indices. It also gets along well with <a href="group.html">Group</a>: for example, <code><span class='Function'>/</span><span class='Modifier2'>⊸</span><span class='Function'>⊔</span></code> groups <code><span class='Value'>𝕩</span></code> according to a list of lengths <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=MuKAvzXigL8w4oC/MSAv4oq44oqUICJBQkNERUZHSCI=">↗️</a><pre> <span class='Number'>2</span><span class='Ligature'>‿</span><span class='Number'>5</span><span class='Ligature'>‿</span><span class='Number'>0</span><span class='Ligature'>‿</span><span class='Number'>1</span> <span class='Function'>/</span><span class='Modifier2'>⊸</span><span class='Function'>⊔</span> <span class='String'>"ABCDEFGH"</span> +⟨ "AB" "CDEFG" ⟨⟩ "H" ⟩ +</pre> +<p>This function will fail to include trailing empty arrays; the modification <code><span class='Paren'>(</span><span class='Function'>/∾</span><span class='Modifier2'>⟜</span><span class='Number'>1</span><span class='Paren'>)</span><span class='Modifier2'>⊸</span><span class='Function'>⊔</span></code> fixes this and ensures the result always has as many elements as <code><span class='Value'>𝕨</span></code>.</p> +<p>If <code><span class='Value'>𝕩</span></code> is boolean then <code><span class='Function'>/</span><span class='Value'>𝕩</span></code> contains all the indices where a 1 appears in <code><span class='Value'>𝕩</span></code>. Applying <code><span class='Function'>-</span><span class='Modifier2'>⟜</span><span class='Function'>»</span></code> to the result gives the distance from each 1 to the previous, or to the start of the list, another potentially useful function.</p> +<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=LyAw4oC/MeKAvzDigL8x4oC/MOKAvzDigL8w4oC/MOKAvzHigL8wCgot4p+cwrsgLyAw4oC/MeKAvzDigL8x4oC/MOKAvzDigL8w4oC/MOKAvzHigL8w">↗️</a><pre> <span class='Function'>/</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'>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'>0</span><span class='Ligature'>‿</span><span class='Number'>1</span><span class='Ligature'>‿</span><span class='Number'>0</span> +⟨ 1 3 8 ⟩ + + <span class='Function'>-</span><span class='Modifier2'>⟜</span><span class='Function'>»</span> <span class='Function'>/</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'>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'>0</span><span class='Ligature'>‿</span><span class='Number'>1</span><span class='Ligature'>‿</span><span class='Number'>0</span> +⟨ 1 2 5 ⟩ +</pre> +<p>With more effort we can also use <code><span class='Function'>/</span></code> to analyze groups of 1s in the argument (and of course all these methods can be applied to 0s instead, by first flipping the values with <code><span class='Function'>¬</span></code>). First we highlight the start and end of each group by comparing the list with a shifted copy of itself. Or rather, we'll first place a 0 at the front and then at the end, in order to detect when a group starts at the beginning of the list or ends at the end (there's also a <a href="shift.html">shift</a>-based version, <code><span class='Function'>≠</span><span class='Modifier2'>⟜</span><span class='Function'>«</span><span class='Number'>0</span><span class='Function'>∾</span><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=MCAo4oi+4omN4oi+y5wpIDDigL8x4oC/MeKAvzHigL8w4oC/MOKAvzHigL8w4oC/MeKAvzHigL8wCgowICjiiL7iiaDiiL7LnCkgMOKAvzHigL8x4oC/MeKAvzDigL8w4oC/MeKAvzDigL8x4oC/MeKAvzAKCi8gMCjiiL7iiaDiiL7LnCkgMOKAvzHigL8x4oC/MeKAvzDigL8w4oC/MeKAvzDigL8x4oC/MeKAvzA=">↗️</a><pre> <span class='Number'>0</span> <span class='Paren'>(</span><span class='Function'>∾≍∾</span><span class='Modifier'>˜</span><span class='Paren'>)</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'>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><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> +┌─ +╵ 0 0 1 1 1 0 0 1 0 1 1 0 + 0 1 1 1 0 0 1 0 1 1 0 0 + ┘ + + <span class='Number'>0</span> <span class='Paren'>(</span><span class='Function'>∾≠∾</span><span class='Modifier'>˜</span><span class='Paren'>)</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'>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><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> +⟨ 0 1 0 0 1 0 1 1 1 0 1 0 ⟩ + + <span class='Function'>/</span> <span class='Number'>0</span><span class='Paren'>(</span><span class='Function'>∾≠∾</span><span class='Modifier'>˜</span><span class='Paren'>)</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'>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><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> +⟨ 1 4 6 7 8 10 ⟩ +</pre> +<p>So now we have the indices of each transition from 0 to 1 or 1 to 0, in an extended list with 0 added at the beginning and end. The first index has to be for a 0 to 1 transition, because we forced the first value to be a 0, and then the next can only be 1 to 0, then 0 to 1, and so on until the last, which must be 1 to 0 because the last value is also 0.</p> +<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=LcucYMuYIOKImOKAvzLipYovIDAo4oi+4omg4oi+y5wpIDDigL8x4oC/MeKAvzHigL8w4oC/MOKAvzHigL8w4oC/MeKAvzHigL8w">↗️</a><pre> <span class='Function'>-</span><span class='Modifier'>˜`˘</span> <span class='Modifier2'>∘</span><span class='Ligature'>‿</span><span class='Number'>2</span><span class='Function'>⥊/</span> <span class='Number'>0</span><span class='Paren'>(</span><span class='Function'>∾≠∾</span><span class='Modifier'>˜</span><span class='Paren'>)</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'>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><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> +┌─ +╵ 1 3 + 6 1 + 8 2 + ┘ +</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> +<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 ⟩ + + <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'>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'>2</span> +⟨ 3 2 1 ⟩ +</pre> +<p>Finding how many times each index appears in a list of indices is often a useful thing to do, and there are a few ways to do it:</p> +<a class="replLink" title="Open in the REPL" target="_blank" href="https://mlochbaum.github.io/BQN/try.html#code=K8udy5ggKOKGlTUpID3ijJwgMuKAvzLigL804oC/MeKAvzLigL8wICAjIEluZWZmaWNpZW50CgriiaDCqOKKlCAy4oC/MuKAvzTigL8x4oC/MuKAvzAKCi/igbziiKcgMuKAvzLigL804oC/MeKAvzLigL8w">↗️</a><pre> <span class='Function'>+</span><span class='Modifier'>˝˘</span> <span class='Paren'>(</span><span class='Function'>↕</span><span class='Number'>5</span><span class='Paren'>)</span> <span class='Function'>=</span><span class='Modifier'>⌜</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'>1</span><span class='Ligature'>‿</span><span class='Number'>2</span><span class='Ligature'>‿</span><span class='Number'>0</span> <span class='Comment'># Inefficient +</span>⟨ 1 1 3 0 1 ⟩ + + <span class='Function'>≠</span><span class='Modifier'>¨</span><span class='Function'>⊔</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'>1</span><span class='Ligature'>‿</span><span class='Number'>2</span><span class='Ligature'>‿</span><span class='Number'>0</span> +⟨ 1 1 3 0 1 ⟩ + + <span class='Function'>/</span><span class='Modifier'>⁼</span><span class='Function'>∧</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'>1</span><span class='Ligature'>‿</span><span class='Number'>2</span><span class='Ligature'>‿</span><span class='Number'>0</span> +⟨ 1 1 3 0 1 ⟩ +</pre> +<p>For <code><span class='Function'>/</span><span class='Modifier'>⁼</span></code> to work, the argument has to be sorted: otherwise it won't be a valid result of <code><span class='Function'>/</span></code>. But sorting with <code><span class='Function'>∧</span></code> is no problem, and <code><span class='Function'>/</span><span class='Modifier'>⁼</span><span class='Function'>∧</span></code> will probably be faster than <code><span class='Function'>≠</span><span class='Modifier'>¨</span><span class='Function'>⊔</span></code> in the absence of special handling for either combination.</p> |
