That would be a very bad thing. If the data in the array was a mix of
numeric and non-numeric values, then some comparisons would be performed
one way, others differently. You would never be able to get a reliable sort
result. It would be a little bit like the comparison

if '0000' = '00e0' then say "Hi"

giving a true result. Because the "=" operator is used rather than '==',
the numeric comparison got used because "00e0" is a valid numeric
representation for zero. In a sort, a lot more comparisons need to be
performed, so it is important that each one be done using the same set of
rules, not changing suddenly because of some quirk in the data.

Again, the sortWith method and the Comparator class were designed to give
you the flexibility to decide precisely how the comparisons get performed
if the default does not meet your requirements.

Rick

Rick

On Mon, May 14, 2018 at 4:01 PM, Leslie Turriff <[email protected]> wrote:

> On 2018-05-14 14:39:36 Rick McGuire wrote:
> > Frankly, a request for a NumericColumnComparator would fall pretty far
> down
> > the list of things I might work on, but once you have written one
> yourself,
> > you can reuse it over and over again in as many places you want.
>
>         What I was thinking was that the built-in sort comparators ought
> to notice
> when the values provided are numeric (when added to 0) and do the numeric
> comparison internally.
>
> ------------------------------------------------------------
> ------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Oorexx-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/oorexx-devel
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Oorexx-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/oorexx-devel

Reply via email to