[ruby-core:76663] Re: [Ruby trunk Feature#12648] `Enumerable#sort_by` with descending option
From:
Martin J. Dürst <duerst@...>
Date:
2016-08-02 11:24:06 UTC
List:
ruby-core #76663
On 2016/08/02 18:57, sawadatsuyoshi@gmail.com wrote:
> Issue #12648 has been reported by Tsuyoshi Sawada.
> Feature #12648: `Enumerable#sort_by` with descending option
> https://bugs.ruby-lang.org/issues/12648
I have felt the need for such an additional argument (or something
similar) quite recently. But the examples with numbers aren't very
convincing, just changing
array.sort_by { |e| e }
to
array.sort_by { |e| -e }
will do the job. But there are many cases where that's not possible,
starting with strings.
Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>