Find (โท) searches for occurrences of an array ๐จ within ๐ฉ. The result contains a boolean for each possible location, which is 1 if ๐จ was found there and 0 if not.
"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. So we can use Windows to see all the arrays ๐จ will be compared against.
2 โ "xxbdxxxcx" โโ โต"xx xb bd dx xx xx xc cx" โ "xx"โธโกห 2 โ "xxbdxxxcx" โจ 1 0 0 0 1 1 0 0 โฉ
Like Windows, the result usually doesn't have the same dimensions as ๐ฉ. This is easier to see when ๐จ is longer. It differs from APL's version, which includes trailing 0s in order to maintain the same length. Bringing the size up to that of ๐ฉ is easy enough with Take (โ), while shortening a padded result would be harder.
"string" โท "substring" โจ 0 0 0 1 โฉ "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 (โ) 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" โจโฉ 9 โ "short" Error: โ: Window length ๐จ must be at most axis length plus one 0 โฃยด "loooooong" โท "short" 0
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 ๐ฉ.
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 โโ โต 1 1 1 1 1 1 1 1 1 0 1 2 3 0 1 2 3 0 0 1 0 1 0 1 0 1 0 0 1 0 3 0 1 0 3 0 0 1 0 1 0 1 0 1 0 0 1 0 3 0 1 0 3 0 0 1 0 1 0 1 0 1 0 โ (0โฟ3โฟ0โ0โฟ1โฟ0) โท a โโ โต 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 1 โ
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.
0โฟ1โฟ0โฟ1 โท a โโ โต 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 1 0 0 0 0 0 0 0 1 0 1 0 1 0 0 0 0 0 0 0 1 0 1 0 1 0 โ