Topic: APLX Help : Help on APL language : APL Primitives : ⍥ Intersection
[ Previous | Next | Contents | Index | APL Home ]

www.microapl.co.uk

Intersection


Intersection returns a vector containing all those items in the left argument which can also be found in the right argument. The right argument can be of any shape or rank. The left argument must be a scalar or vector. The result is always a vector.

The items are returned in the order in which they appear in the left argument. If a particular item appears more than once in the left argument, it will also appear more than once in the result.

When the arguments are nested, an exact match in data and structure must be found for two items to be considered identical. This operation is affected by ⎕CT, the comparison tolerance.

       'THE QUALITY OF MERCY IS NOT STRAINED'∩'AEIOU'
EUAIOEIOAIE
       A←'THIS' 'AND' 'THAT'                                                  
       A∩'T'
                              ⍝ (No match for the single character T)
       A∩'AND'
                              ⍝ (No match for any of the three characters A N D)
       A∩⊂'AND'
 AND
      1 4 17 23 12 2 7 99 33∩2 2⍴⍳4
1 4 2

See also the other 'set' operations: Unique, Union and ~ Without.


Topic: APLX Help : Help on APL language : APL Primitives : ⍥ Intersection
[ Previous | Next | Contents | Index | APL Home ]