You can only sort things which have stable (in)equality and smaller-
than/larger-than relationships. The most common example is numbers,
but it is also possible to sort text (of course under the hood, text
is numbers as well). If you need to sort points, what you're actually
doing is extracting all the x-coordinates (numbers), and sorting that
list instead. In the meantime, you make sure that whenever you swap
two numbers in the keys list in order to improve the ascending nature
of the list, you also swap the same two points. That way, you can sort
a list of points.

Another example would be to sort curves. Curves themselves are not
very comparable, so instead you calculate the length for each curve
(you get a list of numbers), sort the length array and simultaneously
sort the curve array. Let's say we have 6 curves, each of which with
the different length:

{L, XS, M, XL, S, XXL}

the lengths are:

{50, 1, 25, 60, 5, 200}

If we sort the list of numbers, we get a very predictable:

{1, 5, 25, 50, 60, 200}

and if we make sure that the cure list is kept 'in synch' during the
the sort-operation, it will have become:

{XS, S, M, L, XL, XXL}


The list that is used for sorting is called the 'keys-list', the list
that is sorted synchronously is called the 'values-list'.

Often the hardest thing is to create a meaningful keys-list,
especially if you need to sort a multi-dimensional dataset as opposed
to a linear one...

--
David Rutten
Robert McNeel & Associates



On Oct 10, 8:05 am, oompa_l <[EMAIL PROTECTED]> wrote:
> thanks taz. it seemed like it should be extremely easy, I just
> couldn't figure it out. Still, I have to admit that I dont really
> understand what the sorted "keys" are...it doesnt sound like you're
> completely certain either.
>
> thanks
> G

Reply via email to