diff options
| author | Marshall Lochbaum <mwlochbaum@gmail.com> | 2022-07-04 22:25:39 -0400 |
|---|---|---|
| committer | Marshall Lochbaum <mwlochbaum@gmail.com> | 2022-07-04 22:25:39 -0400 |
| commit | df5ddc0ed2fe48411645228c6e2d596be239a0c6 (patch) | |
| tree | 3a18a3674130c5aa646ac23106de3570eb03ae8d /doc/find.md | |
| parent | 81c0f0844edeb2a92f6644455c100700cab6c3c8 (diff) | |
A few edits more
Diffstat (limited to 'doc/find.md')
| -rw-r--r-- | doc/find.md | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/doc/find.md b/doc/find.md index 5309909f..6958365a 100644 --- a/doc/find.md +++ b/doc/find.md @@ -6,7 +6,7 @@ Find (`โท`) searches for occurrences of an array `๐จ` within `๐ฉ`. The resu "xx" โท "xxbdxxxcx" -More precisely `๐จ` needs to [match](match.md) a contiguous selection from `๐ฉ`, which for strings means a substring. These subarrays of `๐ฉ` are also exactly the cells in the result of [Windows](windows.md). In fact we can use Windows to see all the arrays `๐จ` will be compared against. +More precisely, `๐จ` needs to [match](match.md) a contiguous selection from `๐ฉ`, which for strings means a substring. These subarrays of `๐ฉ` are also exactly the cells in the result of [Windows](windows.md). So we can use Windows to see all the arrays `๐จ` will be compared against. 2 โ "xxbdxxxcx" @@ -18,7 +18,7 @@ Like Windows, the result usually doesn't have the same dimensions as `๐ฉ`. Thi "string" (โขโโขโโท) "substring" # APL style -If `๐จ` is larger than `๐ฉ`, the result is empty, and there's no error even in cases where Windows would fail. One place this tends to come up is when applying [First](pick.md#first) (`โ`) the result: `โโท` tests whether `๐จ` appears in `๐ฉ` at the first position, that is, whether it's a prefix of `๐ฉ`. If `๐จ` is longer than `๐ฉ` it shouldn't be a prefix. First will fail but using a [fold](fold.md) `0โฃยดโฅโโท` instead gives a 0 in this case. +If `๐จ` is larger than `๐ฉ`, the result is empty, and there's no error even in cases where Windows would fail. One place this tends to come up is when applying [First](pick.md#first) (`โ`) to the result: `โโท` tests whether `๐จ` appears in `๐ฉ` at the first position, that is, whether it's a prefix of `๐ฉ`. If `๐จ` is longer than `๐ฉ` it shouldn't be a prefix. First will fail but using a [fold](fold.md) `0โฃยดโท` instead gives a 0 in this case. "loooooong" โท "short" @@ -26,7 +26,7 @@ If `๐จ` is larger than `๐ฉ`, the result is empty, and there's no error even 0 โฃยด "loooooong" โท "short" -This pattern also works in the high-rank case discussed below, testing whether `๐จ` is a multi-dimensional prefix starting at the lowest-index corner of `๐ฉ`. +Adding a [Deshape](reshape.md#deshape) gives `0โฃยดโฅโโท`, which works with the high-rank case discussed below. It tests whether `๐จ` is a multi-dimensional prefix starting at the lowest-index corner of `๐ฉ`. ### Higher ranks @@ -36,6 +36,6 @@ If `๐จ` and `๐ฉ` are two-dimensional then Find does a two-dimensional search (0โฟ3โฟ0โ0โฟ1โฟ0) โท a -It's also allowed for `๐จ` to have a smaller rank than `๐ฉ`; in this case leading axes of `๐ฉ` are mapped over so that axes of `๐จ` correspond to trailing axes of `๐ฉ`. This is a minor violation of the [leading axis](leading.md) principle, which would match axes of `๐จ` to leading axes of `๐ฉ` in order to make a function that's useful with the Rank operator, but such a function would be quite strange and hardly ever useful. +It's also allowed for `๐จ` to have a smaller rank than `๐ฉ`; the axes of `๐จ` then correspond to trailing axes of `๐ฉ`, so that leading axes of `๐ฉ` are mapped over. This is a minor violation of the [leading axis](leading.md) principle, which would match axes of `๐จ` to leading axes of `๐ฉ` in order to make a function that's useful with the Rank operator, but such a function would be quite strange and hardly ever useful. 0โฟ1โฟ0โฟ1 โท a |
