The notion is to provide an ordering which “fits in”, for the purposes of things like sort. Consider sorting a set of real numbers. This proposal makes the numbers sort the same way no matter whether their representation is Real, Complex, or some combination of the two.

If you did want to sort on their magnitude instead, it is a simple matter of saying `sort({ .abs })`

— and again, this works the same way whether you have Reals or Complexes.

Mind you, the decision to work this way is informed by my sense that people usually do not define an ordering on Complex numbers. (For instance, a quick check suggests the C++ standard does not define any comparison operators for Complex numbers.) If you have more knowledge on this subject I’m certainly interested in hearing it.

This is by no means set in stone yet. For sure one thing I’m still thinking about is whether the list of reals should be automatically extended with zeroes, so that -4 == (-4 + 0i). Yesterday I thought the answer was no, typing this today I’m inclined to think it should be yes.

]]>What you are suggesting produces an ordering, but not useful for the domain where complex numbers are typically used.

Or am I just being completely mislead by my lack of Perl6 comprehension?

]]>