Logiweb(TM)

7.2.5 Relations

Prev Up Next Page 174 of 800 Search internet


The relations x < y [x < y], x <= y [x <= y], x > y [x > y], and x >= y [x >= y] have the usual behavior when applied to integers. Some examples read:

2 < 3 == true

3 < 2 == false

Note that

2 < 3 == true

means

( 2 < 3 ) == true

These relations throw exceptions when applied to non-integers.

The relations x = y [x = y] and x != y [x != y] can compare more than integers. Here are some examples:

2 = 3 == false

true = false == false

true = 3 == false

<< 1 ,, 2 ,, 3 >> = << 1 ,, 2 ,, 3 >> == true

Again, note that

2 = 3 == false

means

( 2 = 3 ) == false

For more on << 1 ,, 2 ,, 3 >> see the section on tuples.

x = y refuses to compare exceptions and cannot do anything sensible with bottom:

2 = exception == exception

2 = bottom == bottom

Every now and then x = y may give a surprise:

true = <<>> == true

But that happens just because true represents not only truth but is also used for representing the empty tuple, the empty array, and other empty structures, c.f. Truth and falsehood.

Prev Up Next Page 174 of 800 Search logiweb.eu

Copyright © 2010 Klaus Grue, GRD-2010-01-05