APLX Help : Help on APL language : APL Primitives : ⍷ Find
|
|
|
|
|
Find searches for instances of the left argument within the right argument. A boolean result is returned with a 1 where the start of the left argument is found in the right argument. The shape of the result is the same as the shape of the right argument. 'ME'⍷'HOME AGAIN' (Find the pattern 'ME' in 'HOME AGAIN')
0 0 1 0 0 0 0 0 0 0
WEEK
SUNDAY
MONDAY
TUESDAY
WEDNESDAY
THURSDAY
FRIDAY
SATURDAY
'DAY' ⍷ WEEK (Find the pattern 'DAY' in WEEK)
0 0 0 1 0 0 0 0 0
0 0 0 1 0 0 0 0 0
0 0 0 0 1 0 0 0 0
0 0 0 0 0 0 1 0 0
0 0 0 0 0 1 0 0 0
0 0 0 1 0 0 0 0 0
0 0 0 0 0 1 0 0 0
WEEK ⍷ 'DAY' (WEEK not found in 'DAY' - wrong rank)
0 0 0
The arguments can be of any rank, but (1 2) (3 4) ⍷ 'START' (1 2 3) (1 2) (3 4)
0 0 1 0 (Search within nested vector)
MAT
1 2 3 4 5
6 7 8 9 10
11 12 13 14 15
16 17 18 19 20
(2 2⍴7 8 12 13)⍷MAT (Search pattern is a matrix)
0 0 0 0 0 (1 shows top left corner)
0 1 0 0 0
0 0 0 0 0
0 0 0 0 0
See also the system function |
|
APLX Help : Help on APL language : APL Primitives : ⍷ Find
|
|
Copyright © 1996-2010 MicroAPL Ltd