A
Axel Etzold
Dear all,
I have many arrays like
a=[{'a',10,'b',3},{'a',10,'b',4},{'a',5,'b',13},{'a',13,'b',13},
{'a',10,'b',7},{'a',5,'b',3}]
which I'd like to sort such that I get the hashes with the highest
values of 'a' first. If there are ties, I'd like to sort them (but not
the entire array) such
that the highest values of 'b' come first.
So I can't just sort for 'a'-values first and then for 'b'-values,
as this would destroy the first sort order.
Is there a built-in way of getting the ties in sorting, such as an
Array of the results of the <=> comparisons ?
Thank you!
Best regards,
Axel
I have many arrays like
a=[{'a',10,'b',3},{'a',10,'b',4},{'a',5,'b',13},{'a',13,'b',13},
{'a',10,'b',7},{'a',5,'b',3}]
which I'd like to sort such that I get the hashes with the highest
values of 'a' first. If there are ties, I'd like to sort them (but not
the entire array) such
that the highest values of 'b' come first.
So I can't just sort for 'a'-values first and then for 'b'-values,
as this would destroy the first sort order.
Is there a built-in way of getting the ties in sorting, such as an
Array of the results of the <=> comparisons ?
Thank you!
Best regards,
Axel