Mark Biggar wrote:
Jonathan Lang wrote:
> They can be:
>
> $A > $B if $A.x > $B.x | $A.y > $B.y;
> $A < $B if $A.x < $B.x | $A.y < $B.y;
That dosn't work.
Agreed. The above was written in haste, and contained a couple of
fatal syntax errors that I didn't intend. Try this:
multi infix:< <= > (Complex $A, Complex $B) {
$A.x < $B.x || $A.x == $B.x && $A.y <= $B.y
}
or
multi infix:< <= > (Complex $A, Complex $B) {
$A == $B || pi()/2 < ($A - $B).a <= 3*pi()/2 # if $.a is
normalized to 0..2*pi()
}
This is transitive, reflexive, and anti-symmetric. The underlying
rule for <= in English: anywhere to the west, or due south, or equal.
--
Jonathan "Dataweaver" Lang