diff options
| author | Marshall Lochbaum <mwlochbaum@gmail.com> | 2022-06-11 20:08:12 -0400 |
|---|---|---|
| committer | Marshall Lochbaum <mwlochbaum@gmail.com> | 2022-06-11 20:08:12 -0400 |
| commit | b6bcf214e638fd36ef7d76c9f573a84e6e016482 (patch) | |
| tree | a435e4f0afed7266b868798e51b792c4600fabe1 /doc/take.md | |
| parent | 383298b70274c5ac22eb2100aad7f6cd8eeca02d (diff) | |
Nothing but edits yet again
Diffstat (limited to 'doc/take.md')
| -rw-r--r-- | doc/take.md | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/doc/take.md b/doc/take.md index 0244051e..2e549b67 100644 --- a/doc/take.md +++ b/doc/take.md @@ -47,18 +47,19 @@ The basic idea of Take (`β`) is to get the first few elements of a list, while - `π©` can be an atom, or array of any rank (the result will be an array). - `π¨` can be negative to take or drop from the end instead of the beginning. - For Take, if `π¨` is larger than the length of `π©`, then [fills](fill.md) are added. -- `π¨` can have multiple numbers corresponding to leading axes of `π©`. +- `π¨` can have multiple numbers corresponding to [leading](leading.md) axes of `π©`. - `π¨` is allowed to be longer than the rank of `π©`; `π©` will be extended to fit. -These extensions can be combined as well, so there are a lot of possibilities. A good picture to have in mind is cutting out a corner of the array `π©`. This is because the result `π¨βπ©` or `π¨βπ©` always aligns with one side of `π©` along each axis, so it aligns with the corner where those sides meet. +These extensions can be combined as well, so there are a lot of possibilities. A good picture to have in mind is cutting out a corner of the array `π©`. This is because the result `π¨βπ©` or `π¨βπ©` always aligns with one side of `π©` along each axis, so it also aligns with the corner where those sides meet. The result `dβπ©` is always the same as `tβπ©` for some other argument `t`, but computing `t` wouldn't be too convenient. The reverse isn't true: only Take can insert fills, so results that include them can't come from Drop. ## One axis -Let's start with a natural number `π¨`. Take gives the first `π¨` major cells of `π©` (or elements of a list), while Drop gives all but the first `π¨`. +Let's start with a natural number `π¨`. Take gives the first `π¨` [major cells](array.md#cells) of `π©` (or elements of a list), while Drop gives all but the first `π¨`. 4 β "take and drop" + 4 β "take and drop" 1 β >"maj"βΏ"orc"βΏ"ell" @@ -81,7 +82,7 @@ If `π©` is an atom or unit array, it's converted to a list first. For Take thi ### Negative argument -If `π¨` is negative then wraps around the other side to take or drop from the end of `π©`. It's a lot like negative indices in [Select](select.md) (`β`), but while negative indices are asymmetricβ`0` is the first entry but `Β―1` is the lastβthis case is symmetric. It's because the place to cut is always *before* the index `π¨`, cancelling out the negative index asymmetry. +If `π¨` is negative, it wraps around the other side to take or drop from the end of `π©`. It's a lot like negative indices in [Select](select.md) (`β`), but while negative indices are asymmetricβ`0` is the first entry but `Β―1` is the lastβthis case is symmetric. It's because the place to cut is always *before* the index `π¨`, cancelling out the negative index asymmetry. 3 β "abcdeEDCBA" @@ -95,13 +96,13 @@ What about `0`? It behaves like it's both positive *and* negative. For Take, the 0 β 4βΏ3βΏ2 # Everything -If `|π¨` is too large, then Take will insert fills at the beginning to keep the result aligned with `π©` at the end. Drop returns an empty array as in the positive case. So unlike [Rotate](reverse.md) (`β½`), which is completely cyclical, Take and Drop work cyclically only around 0. +If `|π¨` is too large, then Take will insert fills at the beginning to keep the result aligned with `π©` at the end. Drop returns an empty array as in the positive case. So unlike [Rotate](reverse.md) (`β½`), which is completely cyclical, Take and Drop look cyclic only around 0. Β―6 β "xy" ## Multiple axes -In the general case `π¨` is a list of integers. They're matched with the leading axes of `π©`, so that each affects one axis independently from the others. +In the general case `π¨` is a list of integers. They're matched with the [leading axes](leading.md) of `π©`, so that each affects one axis independently from the others. β’ m β (10Γβ5) +β β7 |
