Find

From NARS2000
Jump to: navigation, search

Z←L⍷R


Find looks for patterns L in R.
It returns a simple boolean array with the same shape as R.

L and R are arbitrary arrays. But to be useful, the rank of L should not be more than the rank of R, and both arguments should have the same type (either both character or both numeric).

If L is a scalar, then Z←L⍷R ←→ R∊L.
If L is not a scalar, then it represents a contiguous pattern, which may or may not be found in one or more places in R.

If the arguments are numeric, then the result is sensitive to ⎕CT.

Examples:


       R←3 8⍴'thirteenfourteenfifteen '
       R
thirteen
fourteen
fifteen


       't'⍷R
1 0 0 0 1 0 0 0
0 0 0 0 1 0 0 0
0 0 0 1 0 0 0 0


       'teen'⍷R
0 0 0 0 1 0 0 0
0 0 0 0 1 0 0 0
0 0 0 1 0 0 0 0