From 2010e8b2897a5741e211980c9f8ec9177299c939 Mon Sep 17 00:00:00 2001 From: Marshall Lochbaum Date: Fri, 16 Jul 2021 18:23:52 -0400 Subject: Finish links and editing documentation pass --- docs/doc/select.html | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'docs/doc/select.html') diff --git a/docs/doc/select.html b/docs/doc/select.html index 48f2af19..61a0f38d 100644 --- a/docs/doc/select.html +++ b/docs/doc/select.html @@ -48,7 +48,7 @@ -

The function Select (⊏) reorganizes the array 𝕩 along one or more axes based on indices given by 𝕨. The result has the same depth as 𝕩, since its elements are always elements of 𝕩. This means it differs from Pick (βŠ‘), which takes elements from 𝕩 but can arrange them in any nested structure, including returning an element directly.

+

The function Select (⊏) reorganizes the array 𝕩 along one or more axes based on indices given by 𝕨. The result has the same depth as 𝕩, since its elements are always elements of 𝕩. This means it differs from Pick (βŠ‘), which takes elements from 𝕩 but can arrange them in any nested structure, including returning an element directly.

The monadic form First Cell (⊏) gets the major cell with index 0, so that βŠπ•© is identical to 0βŠπ•©.

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 principle, Select returns a major cell of 𝕩 when 𝕨 is an atom.

@@ -114,7 +114,8 @@ ERROR 0 1 4 9 5 3 3 β”˜ -

More generally, 𝕨 can be an array of any rank. Each of its 0-cellsβ€”containing a single numberβ€”is replaced with a cell of 𝕩 in the result. The result's shape is then made up of the shape of 𝕨 and the major cell shape of 𝕩: it's (≒𝕨)∾1↓≒𝕩. When 𝕩 is a list, the result has the same shape as 𝕨. Elements of 𝕨 are replaced one-for-one with elements of 𝕩.

+

More generally, 𝕨 can be an array of any rank. Each of its 0-cellsβ€”containing a single numberβ€”is replaced with a cell of 𝕩 in the result. The result's shape is then made up of the shape of 𝕨 and the major cell shape of 𝕩: it's (≒𝕨)∾1↓≒𝕩.

+

When 𝕩 is a list, the result has the same shape as 𝕨. Elements of 𝕨 are replaced one-for-one with elements of 𝕩.

↗️
    2|m
 β”Œβ”€               
 β•΅ 0 1 1 0 1 1 0  
@@ -168,8 +169,8 @@ ERROR
   ⟨ 1 3 ⟩ ⟨ 1 0 ⟩ ⟨ 1 0 ⟩  
                           β”˜
 
-

Using a range for 𝕩 shows the structure of the selected elements more clearly, because each element is its own index. Each element of 𝕨 acts independently, giving a structure like the Table modifier.

-

While 𝕨 must have rank one or less, its elements can have any rank. When the elements are units, the corresponding axis of 𝕩 disappears from the result. We can select a 0-cell of 𝕩 in this way, although the more common case or selecting an element is handled by Pick.

+

Using a range for 𝕩 shows the structure of the selected elements more clearly, because each element is its own index. Each element of 𝕨 acts independently, giving a structure like the Table modifier.

+

While 𝕨 must have rank one or less, its elements can have any rank. When the elements are units, the corresponding axis of 𝕩 disappears from the result. We can select a 0-cell of 𝕩 in this way, although the more common case of selecting an element is handled by Pick.

↗️
    ⟨<4,<5,<1⟩ ⊏ (3β₯Š10)β₯Šβ†•1e3
 β”ŒΒ·     
 Β· 451  
@@ -182,4 +183,4 @@ ERROR
 ⟨ 450 451 452 453 454 455 456 457 458 459 ⟩
 

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 the result would yield the same value.

-

Selection only ever applies to leading axes of 𝕩. But 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 ˘ or βŽ‰, to select on any contiguous set of axes. In particular, use the one-axis case π•¨βŠΈβŠβŽ‰(-k) 𝕩 to select along axis k of 𝕩.

-- cgit v1.2.3