symcmp

symcmp — compares symbols to see if they are equal.

Syntax

symcmp (symbol, symbol)
    

Arguments

symbol

Any valid Gamma symbol.

Returns

A negative number if the first symbol is ordinally less than the second symbol according to the ASCII character set, a positive number if the first symbol is greater than the second, and zero if the two symbol strings are exactly equal.

Description

This function compares symbols to see if they are equal. Neither of the symbols are evaluated when passed to the function. This function can be used as a comparison function for sort and insert.

Example

This example was done in the Script Log.

--> symcmp(a,b);
-1
--> symcmp(a,a);
0
--> symcmp(b,a);
1
-->  y = array(#c, #d, #a);
[c d a]
--> y = sort(y, symcmp);
[a c d]
--> insert(y, symcmp, #b);
b
--> y;
[a b c d]