compare

The compare function returns 0 if two objects: {obj1} and {obj2} are equivalent. If the value of the first object {obj1} is less than the value of the second object {obj1}, then 1 is returned. If {obj1} is greater than {obj2}, then +1 is returned.
The compare Function returns 0 if both Strings are equivalent. If string1 is less than string2, then 1 is returned. If string1 is greater than string2, then +1 is returned.
The compare Function returns 0 if both Symbols are equivalent. If {sym1} is less than {sym2} , then 1 is returned. If {sym1} is greater than {sym2} , then +1 is returned.
The compare Function returns 0 if its arguments are equivalent. If {struct1} is less than {struct2} , then 1 is returned. If {struct1} is greater than {struct2} , then +1 is returned. Two Structures are equal if the keys and values from both are equal.
The compare Function returns 0 if its arguments are equivalent. If {dict1} is less than {dict2} , then 1 is returned. If {dict1} is greater than {dict2} , then +1 is returned. Two Dictionaries are equal if the keys and values from both are equal.
The compare Function returns 0 if its arguments are equivalent. If {dir1} is less than {dir2} , then 1 is returned. If {dir1} is greater than {dir2} , then +1 is returned. Two Directories are equal if the keys and values from both are equal.
The compare function returns 0 if its field data elements are identical. If {brick1} is less than {brick2}, then 1 is returned. If {brick1} is greater than {brick2} , then +1 is returned. Two Bricks are equal if their field data elements are identical.
The compare Function returns 0 if both Matrix arguments are equivalent. If Matrix1 is less than Matrix2, then 1 is returned. If Matrix1 is greater than Matrix2, then +1 is returned. Two Matrices are equal if all of the values from both are equal.
The compare Function returns 0 if both NumMatrix arguments are equivalent. If NumMatrix1 is less than NumMatrix2, then 1 is returned. If NumMatrix1 is greater than NumMatrix2, then +1 is returned. Two NumMatrices are equal if all of the values from both are equal.
The compare function returns 0 if both Pair (or List) arguments are equivalent. If pair1 is less than pair2, then 1 is returned. If pair1 is greater than pair2, then +1 is returned. Two Pairs are equal if all of the values from both are equal.
The compare function returns 0 if two numbers {num1} and {num2} are equivalent. If {num1} is less than {num2}, then 1 is returned. If {num1} is greater than {num2}, then +1 is returned.
Comparison of Date values is a valid operation since Dates are internally represented as numbers. The compare function returns 0 if two dates: {date1} and {date2} are equivalent. If the value of the first object {date1} is less than the value of the second object {date2}, then 1 is returned. If {date1} is greater than {date2}, then +1 is returned.
Comparison of Function values is a valid operation. A function's object id is simply the function name itself. The compare function returns 0 if two function arguments have the same object id: {func1} and {func2}. If the object id of the first function {func1} is less than the object id of the second function {func2}, then 1 is returned. If the object id of the {func1} is greater than {func2}, then +1 is returned.
Comparison of complex values is supported. The compare function returns 0 if two arguments have the same real and imaginary parts. If the first real value {cpx 1} is less than the the second real value {cpx2}, or, if the real parts are equal and the first imaginary value is less than the second imaginary value, then 1 is returned. Similarly, if the first real value of {cpx1} is greater than the real value of {cpx2}, or, if the real parts are equal and the first imaginary part is greater than the second, then +1 is returned.
The compare function tests if two Lambdas equal, greater than, or less than. Two Lambdas are equal, if they have the same variables, constants, and identical PcodeVectors. The compare function returns an Integer value: 0 if the Lambdas are equal, +1 if {Lambda1} is greater than {Lambda2}, and 1 if {Lambda1} is less than {Lambda2}.
The compare function returns 0 if both Object Repository arguments are equivalent. Two Object Repositories are equal if they are the same file. If Object Repository1's filename {aGor1} is less than Object Repository2's filename {aGor2}, then 1 is returned. If Object Repository1's filename {aGor1} is greater than Object Repository2's filename {aGor2}, then +1 is returned.
Usage
Use the compare function when you wish to compare two arguments of the same Data Type and the result value needs to be represented as a numeric (0, 1 or 1). If a Boolean result is desired, then the Comparison Functions (=, <>, <, <=, >, >=) or the compareEQ, compareNE, compareGT, compareGE, compareLT, compareLE should be used instead.
The compare performs a deep compare and will determine if two Lambdas have the same variables, constants and pcode vectors. Usually if an Lambda is cloned (copied) from another Lambda and the cloned Lambda is assigned a new name, the compare will see that the newly cloned Lambda and original Lambda are equivalent and will return 0 (equal).
Expression: 

Arguments  Name  Type  Description 
Argument:  obj1  Void Boolean Character Number Date Complex  The first object to be compared. Must be a native data type (or complex). 

Argument:  obj2  Void Boolean Character Number Date Complex  The second object to be compared. Must be a native data type (or complex). 
Returns:  Returns 0 if the two objects are equal. Returns 1 if the obj1 is less than obj2. Returns +1 if obj1 is greater than obj2. 

Expression: 

Arguments  Name  Type  Description 
Argument:  string1  String  The first String to be compared 

Argument:  string2  String  The second String to be compared 
Returns:  Returns 0 if the two Strings are equal, Returns 1 if the string1 is less than string2, returns +1 if string1 is greater than string2. 

Expression: 

Arguments  Name  Type  Description 
Argument:  sym1  Symbol  The first Symbol to be compared 

Argument:  sym2  Symbol  The second Symbol to be compared 
Returns:  Returns 0 if the two Symbols are equal, Returns 1 if the sym1 is less than sym2, returns +1 if sym1 is greater than sym2. 

Expression: 

Arguments  Name  Type  Description 
Argument:  struct1  Structure  The first Structure to be compared 

Argument:  struct2  Structure  The second Structure to be compared 
Returns:  Returns 0 if the two Structures are equal, Returns 1 if the struct1 is less than struct2, returns +1 if struct1 is greater than struct2. 

Expression: 

Arguments  Name  Type  Description 
Argument:  dict1  Dictionary  The first Dictionary to be compared 

Argument:  dict2  Dictionary  The second Dictionary to be compared 
Returns:  Returns 0 if the two Dictionaries are equal, Returns 1 if the dict1 is less than dict2, returns +1 if dict1 is greater than dict2. 

Expression: 

Arguments  Name  Type  Description 
Argument:  dir1  Directory  The first Directory to be compared 

Argument:  dir2  Directory  The second Directory to be compared 
Returns:  Returns 0 if the two Directories are equal, Returns 1 if dir1 is less than dir2, returns +1 if dir1 is greater than dir2. 

Expression: 

Arguments  Name  Type  Description 
Argument:  vector1  Vector  The first Vector to be compared 

Argument:  vector2  Vector  The second Vector to be compared 
Returns:  Returns 0 if the two Vectors are equal, Returns 1 if vector1 is less than vector2, returns +1 if vector1 is greater than vector2. 

Expression: 

Arguments  Name  Type  Description 
Argument:  vector1  Vector  The first Vector to be compared 

Argument:  vector2  Vector  The second Vector to be compared 
Returns:  Returns 0 if the two Vectors are equal, Returns 1 if vector1 is less than vector2, returns +1 if vector1 is greater than vector2. 

Expression: 

Arguments  Name  Type  Description 
Argument:  vector1  Vector  The first Vector to be compared 

Argument:  vector2  Vector  The second Vector to be compared 
Returns:  Returns 0 if the two Vectors are equal, Returns 1 if vector1 is less than vector2, returns +1 if vector1 is greater than vector2. 

Expression: 

Arguments  Name  Type  Description 
Argument:  vector1  Vector  The first Vector to be compared 

Argument:  vector2  Vector  The second Vector to be compared 
Returns:  Returns 0 if the two Vectors are equal, Returns 1 if vector1 is less than vector2, returns +1 if vector1 is greater than vector2. 

Expression: 

Arguments  Name  Type  Description 
Argument:  vector1  Vector  The first Vector to be compared 

Argument:  vector2  Vector  The second Vector to be compared 
Returns:  Returns 0 if the two Vectors are equal, Returns 1 if vector1 is less than vector2, returns +1 if vector1 is greater than vector2. 

Expression: 

Arguments  Name  Type  Description 
Argument:  vector1  Vector  The first Vector to be compared 

Argument:  vector2  Vector  The second Vector to be compared 
Returns:  Returns 0 if the two Vectors are equal, Returns 1 if vector1 is less than vector2, returns +1 if vector1 is greater than vector2. 

Expression: 

Arguments  Name  Type  Description 
Argument:  vector1  CpxVector  The first CpxVector to be compared 

Argument:  vector2  CpxVector  The second CpxVector to be compared 
Returns:  Returns 0 if the two CpxVector are equal, Returns 1 if vector1 is less than vector2, returns +1 if vector1 is greater than vector2. 

Expression: 

Arguments  Name  Type  Description 
Argument:  vector1  ShortVector  The first ShortVector to be compared 

Argument:  vector2  ShortVector  The second ShortVector to be compared 
Returns:  Returns 0 if the two ShortVectors are equal, Returns 1 if vector1 is less than vector2, returns +1 if vector1 is greater than vector2. 

Expression: 

Arguments  Name  Type  Description 
Argument:  brick1  Brick  The first brick to be compared 

Argument:  brick2  Brick  The second Brick to be compared 
Returns:  Returns 0 if the two Bricks are equal, Returns 1 if brick1 is less than brick2, returns +1 if brick1 is greater than brick2. 

Expression: 

Arguments  Name  Type  Description 
Argument:  matrix1  Matrix  The first Matrix to be compared 

Argument:  matrix2  Matrix  The second Matrix to be compared 
Returns:  Returns 0 if Matrices are equal, Returns 1 if Matrix1 is less than Matrix2, returns +1 if Matrix1 is greater than Matrix2. 

Expression: 

Arguments  Name  Type  Description 
Argument:  nummatrix1  NumMatrix  The first NumMatrix to be compared 

Argument:  nummatrix2  NumMatrix  The second NumMatrix to be compared 
Returns:  Returns 0 if NumMatrices are equal, Returns 1 if NumMatrix1 is less than NumMatrix2, returns +1 if NumMatrix1 is greater than NumMatrix2. 

Expression: 

Arguments  Name  Type  Description 
Argument:  pair1  Pair  The first Pair to be compared 

Argument:  pair2  Pair  The second Pair to be compared 
Returns:  Returns 0 if Pairs are equal, Returns 1 if pair1 is less than pair2, returns +1 if pair1 is greater than pair2 . 

Expression: 

Arguments  Name  Type  Description 
Argument:  list1  List  The first List to be compared 

Argument:  list2  List  The second List to be compared 
Returns:  Returns 0 if Lists are equal, Returns 1 if list1 is less than list2, returns +1 if list1 is greater than list2. 

Expression: 

Arguments  Name  Type  Description 
Argument:  func1  Function  The first Function to be compared. 

Argument:  func2  Function  The second Function to be compared 
Returns:  Returns 0 if the two Function object ids are equal. Returns 1 if the func1 object id is less than func2 object id. Returns +1 if func1 object id is greater than func2 object id. 

Expression: 

Arguments  Name  Type  Description 
Argument:  Lambda1  Lambda  The first Lambda to be compared. 

Argument:  Lambda2  Lambda  The second Lambda to be compared 
Returns:  Returns 0 if the two Lambdas are equal. Returns 1 if the Lambda1 is less than Lambda2. Returns +1 if Lambda1 is greater than Lambda2. 

Expression: 

Arguments  Name  Type  Description 
Argument:  aGor1  ObjectRepository  The first Object Repository to be compared. 

Argument:  aGor2  ObjectRepository  The first Object Repository to be compared. 
Returns:  Returns 0 if the two Object Repositories are equal. Returns 1 if the aGor1 is less than aGor2. Returns +1 if aGor1 is greater than aGor2. 

Here are a number of links to Lambda coding examples which contain this instruction in various use cases.
Here are the links to the data types of the function arguments.
Here are also a number of links to functions having arguments with any of these data types.
Analytic Information Server (AIS)AIS Component Systems
