APLX Help : Help on APL language : APL Primitives : = Equal
|
|
![]() |
|
Compares each element in the right-hand argument with the corresponding element in the left-hand argument and returns 1 if they are equal, 0 if they are not. (This operation is affected by This function works on both numeric and character data. A numeric element is never considered equal to a character element. 12 = 12 1 2 = 12 0 'Q' = 'Q' (Compares character data) 1 1 = '1' (Comparisons between numeric and character 0 data are allowed, but always give 0) 11 7 2 9 = 11 3 2 6 (Compares each element in a vector with 1 0 1 0 the corresponding element in a vector of equal length) 'STOAT' = 'TOAST' 0 0 0 0 1 8 = 2+2+2+2 (The right argument is evaluated 1 before the comparison is made) TABLE←2 3⍴1 2 3 4 5 6 MABLE←2 3⍴3 3 3 5 5 5 TABLE = MABLE (Compares each element in a matrix 0 0 1 with the corresponding element in 0 1 0 a matrix of equal size and dimensions) 3=TABLE 0 0 1 0 0 0 3 = TABLE MABLE (Compares 3 with the elements of the 0 0 1 1 1 1 nested vector) 0 0 0 0 0 0 See also the 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. For example, if Point is a simple class with properties X and Y: PT←⎕NEW Point PT.X←63 ⋄ PT.Y←42 A←PT B←PT.⎕CLONE 1 A.⎕DS X=63, Y=42 B.⎕DS X=63, Y=42 A=PT ⍝ References to the same object 1 B=PT ⍝ Objects are different, but have the same property values 0 For external objects, there might be two references which APL does not know refer to the same object. Therefore the use of the APL Equals primitive on external objects is not recommended. |
|
APLX Help : Help on APL language : APL Primitives : = Equal
|
Copyright © 1996-2010 MicroAPL Ltd