diff options
| author | Marshall Lochbaum <mwlochbaum@gmail.com> | 2022-06-07 22:16:01 -0400 |
|---|---|---|
| committer | Marshall Lochbaum <mwlochbaum@gmail.com> | 2022-06-07 22:16:01 -0400 |
| commit | bed78fe6147cb7921b7367960d406d28d37cb019 (patch) | |
| tree | 5fd5f3ad00bfbd66b19aabc4a3d688815754be1e /doc/select.md | |
| parent | 07be54d8179ba799cc55dacd2c79fb2292477030 (diff) | |
The editing is going to end at some point isn't it?
Diffstat (limited to 'doc/select.md')
| -rw-r--r-- | doc/select.md | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/doc/select.md b/doc/select.md index 4b0af7f4..20303956 100644 --- a/doc/select.md +++ b/doc/select.md @@ -38,7 +38,7 @@ The monadic form First Cell (`β`) gets the major cell with index 0, so that `β ## Single selection -Each axis of a BQN array is numbered starting at zero. Major cells are arranged along the first axis; in accordance with the [leading axis](leading.md) principle, Select returns a major cell of `π©` when `π¨` is an atom. +The [major cells](array.md#cells) of an array are arranged along the [first axis](leading.md) and numbered starting at 0. For a natural number `π¨`, Select returns the major cell of `π©` with index `π¨`. 2 β "abcdef" # An enclosed element @@ -48,7 +48,7 @@ Each axis of a BQN array is numbered starting at zero. Major cells are arranged 0 β <5 # No first axis to select from -As a major cell of `π©`, the result has rank one less than it and its shape is `1ββ’π©`. `π©` must have rank one or more. +As a major cell, the result has rank one less than `π©` and shape `1ββ’π©`. Of course `π©` must have at least one axis to select along, or there are no major cells and you'll get an error. The index `π¨` has to be an integer less than `β π©`. It can be negative, in which case it must be greater than or equal to `-β π©`. Negative indices select from the end of `π©`, in that `Β―1` indicates the last major cell and `-β π©` indicates the first. If `β π©` is 0, then no index is valid. @@ -56,6 +56,8 @@ The index `π¨` has to be an integer less than `β π©`. It can be negative, i 0 β "" +### First Cell + The monadic case First Cell (`βπ©`) is identical to `0βπ©`. It has the same restrictions: `π©` must have rank 1 or more, and length 1 or more. β "abc" @@ -68,7 +70,7 @@ The monadic case First Cell (`βπ©`) is identical to `0βπ©`. It has the s ## First-axis selection -If `π¨` is an array of numbers (including any empty array), then each number indicates a major cell of `π©`. In the simplest case, a list of numbers gives a result with the same rank as `π©` but maybe not the same length. +If `π¨` is an array of numbers (including any empty array), then each number indicates a major cell of `π©`. In the simplest case, a list of numbers gives a result with the same rank as `π©` but the length of `π¨`. 2βΏ3βΏ3βΏ0βΏ4βΏ1 β "OlZEt" @@ -117,4 +119,4 @@ However, the `<Β¨βΈβ` construct can select a cell of any rank from `π©`, be If an element of `π¨` has rank more than 1, it increases the rank of `π©` rather than decreasing it. The general rule is that in the result, one axis of `π©` is replaced by all the axes of the corresponding element of `π¨` (trailing axes are unchanged). So the final shape `β’π¨βπ©` is `(βΎβ’Β¨π¨)βΎπ¨β βΈββ’π©`. But this shape doesn't affect the elements retrieved from `π©`. In all cases, using `β₯Β¨π¨` for the left argument and then [reshaping](reshape.md) the result would yield the same value. -Selection only ever applies to leading axes of `π©`. However, you can skip some leading axes using `Λ` or `β`, to select on any contiguous set of axes. In particular, use the one-axis case `π¨βΈββ(-k) π©` to select along axis `k` of `π©`. +Selection only ever applies to leading axes of `π©`. However, you can skip some leading axes using [Rank](rank.md) modifiers `Λ` or `β`, to select on any contiguous set of axes. In particular, use the one-axis case `π¨βΈββ(-k) π©` to select along axis `k` of `π©`. |
