up previous next
3.3.3 Relational Operators
The relational operators are:
      =    <>    <    >    <=    >=   IsIn
The operator IsIn is quite flexible: see its manual for an explanation. The other relational operators can be applied to two objects of the same type. The admissible types for = and <> are:
     NULL, BOOL, STRING, TYPE, INT, RAT, ZMOD, POLY, RATFUN,
     VECTOR, IDEAL, MODULE, MAT, LIST.
The admissible types for the other relational operators are:
     STRING, TYPE, INT, RAT, IDEAL, MODULE.
The meaning of < for string is the lexicographic comparison. For ideals and modules A < B and A <= B both mean that A is (not necessarily strictly) contained in B.

NOTE: It is sometimes hard to judge the type of an expression from the appearance of CoCoA output, leading to confusing results from the relational operators. Here is an simple example:

Example
  L := "3";
  L;
3
-------------------------------
  L=3;
FALSE
-------------------------------
  Type(L);
STRING
-------------------------------
  Type(3);
INT
-------------------------------
Tagged expressions are especially prone to causing confusion of this sort.