Ammar Ali wrote in post #959889:
If I understood your issue correctly,
Yes, it is exactly that. Your example shows it :
a = [["g", 3], ["c", 3], ["a", 3], ["f", 3], ["e", 2], ["d", 3], ["b",
1]]
b = a.sort_by{ |letter, number| letter}
# = > [["a", 3], ["b", 1], ["c", 3], ["d", 3], ["e", 2], ["f", 3], ["g",
3]]
c = b.sort_by{ |letter, number| number}
# = > [["b", 1], ["e", 2], ["d", 3], ["c", 3], ["a", 3], ["f", 3], ["g",
3]]
Without code, I have to guess
The code for sort_by refers to ruby_qsort
I think a built-in sort method should be stable (or have a stable
variant).
_md
···
--
Posted via http://www.ruby-forum.com/\.