## ¦ Match

Two-argument form See also one-argument form Depth

The match function will test whether its arguments are the same in every respect - depth, rank, shape and corresponding elements. The result is always a scalar 1 or 0.

                 3¦3                     (Two scalars are identical)
           1
                 3¦,3                    (Scalar does not match a vector)
           0
                 4 7.1 8 ¦ 4 7.2 8       (Shape is the same but values are not)
           0
                 (3 4½¼12)¦3 4½¼12       (Two matrices are identical)
           1
                 (3 4 ½¼12)¦›3 4½¼12     (Simple matrix does not match an enclosed
           0                              version of itself)
                 VEC„'ABC' 'DEF'         (Two element vector of 'ABC' 'DEF)
                 VEC
           ABC DEF
                 ½VEC                    (Length 2)
           2
                 VEC¦'ABCDEF'            (Does not match the 6 element vector
           0                              'ABCDEF')

Empty arrays are considered the same only if they have the same type, rank, shape and prototype.

                 (¼0)¦''                 (Types are different)
           0
                 (2 0½0)¦0 2½0           (Shapes are different)
           0
                 (0½›1 2 3)¦0½›2 2½¼4    (Prototypes are different)
           0

The comparisons done by this operation are affected by ŒCT, the comparison tolerance value.

If the arguments contain object (or class) references, the elements are considered equal if the reference indices are the same, i.e. if they refer to the same entry in APL's internal table of objects. For internal objects, this will be true if and only if the elements refer to the same object. Note that different objects which happen to contain the same properties are not considered equal.

Topic: APLX Help : Help on APL language : APL Primitives : ¦ Match

[ Previous | Next | Contents | Index ]