| Perfect Developer tutorial | This page last modified 2004-12-17 (DC) |
1. The expression >-<-4 is in very poor style but nevertheless legal in
Perfect.
How should it be read, and what is its value?
"Successor of minus predecessor of minus 4", or >(-(<(-4)))
, which has the value 6.
2. If it is known that x ~~ y = same@rank , which of the
following can be deduced, if x and y have the same type but the ~~
operator for this type does not define a total ordering?
Is the answer any different if the ~~ operator does define a total ordering?
x >~ y~(x > y)y ~~ x = same@rank~(x < y)x = y
Expression (a) is true because it is equivalent to x ~~ y = same@rank
| x ~~ y = above@rank .
Expression (b) is true because it means ~(x ~~ y = above@rank) .
Expression (c) is true because x ~~ y = same@rank and y ~~ x =
same@rank are each true if and only if x and y are in the same partition.
Expression (d) is true because it means ~(x ~~ y =
below@rank) .
Expression (e) may or may not
be true because values in the same partition are not necessarily equal unless
the ordering is total.
If the ~~ operator defines a total ordering for this type, then
expression (e) must be true as well.