Match

is a dyadic primitive function which indicates whether the left and right argument arrays are identical, taking into account comparison tolerance and possibly ignoring prototypes. The result of Match is always a Boolean scalar: it is 1 if the arrays match and 0 otherwise. Two arrays match if they have the same shape and their corresponding elements and possibly prototypes match—in flat array theory, the elements should be tolerantly equal to each other; in nested array theory, the definition is recursive with the base case of simple scalars, which also match if they are tolerantly equal.

Examples
Match can be used to compare simple vectors to see if they are the same: Using strand notation to create nested arrays, we see that Match also compares elements nested within arrays: Arrays with the same elements but different shapes do not match. Unlike Equal to, Match never gives a RANK ERROR or LENGTH ERROR because of argument shapes. Match depends on comparison tolerance. Here two arrays which are not exactly identical are still reported as matching:

Description
Arrays match if they are equal in all the characteristics defined by APL's array model: The way elements are compared depends on the particular array model used. In flat array theory, elements match if they have the same type (such as numeric or character) and are tolerantly equal. If boxes are possible, then this definition is recursive, because boxes are defined to be equal when the arrays they contain match. In nested array theory, the definition is always recursive. As a base case, simple scalars are defined to match when they are tolerantly equal.
 * Shape (rank, and the length of each axis)
 * Elements
 * For empty arrays, possibly the array's type or prototype

APL model
The following model implements Match in Dyalog APL. Because Match compares the same characteristic of both arguments, Over is used throughout.

History
Match was introduced by NARS with the name "Equivalent"; both Dyalog APL and APL2 included it with the name "Match", which has generally been used in later APLs.

Documentation

 * Dyalog
 * APLX