From df5ddc0ed2fe48411645228c6e2d596be239a0c6 Mon Sep 17 00:00:00 2001 From: Marshall Lochbaum Date: Mon, 4 Jul 2022 22:25:39 -0400 Subject: A few edits more --- docs/doc/find.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'docs/doc/find.html') diff --git a/docs/doc/find.html b/docs/doc/find.html index 09632469..01efff6d 100644 --- a/docs/doc/find.html +++ b/docs/doc/find.html @@ -9,7 +9,7 @@ ↗️
    "xx"  "xxbdxxxcx"
 ⟨ 1 0 0 0 1 1 0 0 ⟩
 
-

More precisely 𝕨 needs to match a contiguous selection from 𝕩, which for strings means a substring. These subarrays of 𝕩 are also exactly the cells in the result of Windows. In fact we can use Windows to see all the arrays 𝕨 will be compared against.

+

More precisely, 𝕨 needs to match a contiguous selection from 𝕩, which for strings means a substring. These subarrays of 𝕩 are also exactly the cells in the result of Windows. So we can use Windows to see all the arrays 𝕨 will be compared against.

↗️
    2  "xxbdxxxcx"
 ┌─    
 ╵"xx  
@@ -32,7 +32,7 @@
     "string" (⊢↑⍷) "substring"  # APL style
 ⟨ 0 0 0 1 0 0 0 0 0 ⟩
 
-

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 () 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 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 () 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 0´ instead gives a 0 in this case.

↗️
    "loooooong"  "short"
 ⟨⟩
 
@@ -42,7 +42,7 @@
     0 ´ "loooooong"  "short"
 0
 
-

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 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

If 𝕨 and 𝕩 are two-dimensional then Find does a two-dimensional search. The cells used are also found in 𝕨𝕩. For example, the bottom-right corner of 𝕩 below matches 𝕨, so there's a 1 in the bottom-right corner of the result.

↗️
     a  7 (4|⋆˜) 9   # Array with patterns
@@ -66,7 +66,7 @@
   0 0 1 0 0 0 1  
                 ┘
 
-

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 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 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.

↗️
    0101  a
 ┌─             
 ╵ 0 0 0 0 0 0  
-- 
cgit v1.2.3