up previous next
3.3.3 Relational Operators
|
***** NOT YET UPDATED TO CoCoA-5: follow with care *****
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:
L := "3";
L;
3
-------------------------------
L=3;
False
-------------------------------
Type(L);
STRING
-------------------------------
Type(3);
INT
-------------------------------
|
Tagged expressions are especially prone to causing confusion of this sort.