-------------- Original message ----------------------
From: "Jonathan Lang" <[EMAIL PROTECTED]>
> 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.

See the following.

http://www.cut-the-knot.org/do_you_know/complex_compare.shtml




--
Mark Biggar
[EMAIL PROTECTED]
[EMAIL PROTECTED]
[EMAIL PROTECTED]

Reply via email to