Sort_by is not stable?

We don't distinguish between the two in JRuby, but it might be a good
trade-off to say that sort_by is stable and sort does not necessarily
have that guarantee.

- Charlie

···

On Fri, Nov 19, 2010 at 2:25 AM, Michel Demazure <michel@demazure.com> wrote:

Just to come back to my initial post : it was not about sort, but about
sort_by.

For sort_by, you need to compute the keys, and sort the indices
according to the keys. It is not in-place sorting. Yes, optimal in-place
quicksort is unstable. But for sort_by, one could use a stable version.

Charles Nutter wrote in post #966242:

... it might be a good
trade-off to say that sort_by is stable and sort does not necessarily
have that guarantee.

Yes indeed.
_md

···

--
Posted via http://www.ruby-forum.com/\.