On Nov 7, 4:22=A0am, Michel Demazure <mic... / demazure.com> wrote:
> sort_by =A0is not a stable sorting method (ruby 1.9.2 p0)
>
> I am doing word statistics in a text file. I have a long array of
> entries [word, number], sorted by alphabetic order on word. When I sort
> on number, entries with the same number are shuffled.
>


I've noticed that it's unstable under 1.8.7:

%w(foo bar car war raw rat cat or bat is).sort.
sort_by{|s| s.size}
    =3D=3D>["is", "or", "bar", "cat", "foo", "car", "bat", "rat", "raw",
"war"]
VERSION
    =3D=3D>"1.8.7"