Issue #8422 has been updated by marcandre (Marc-Andre Lafortune).


drbrain (Eric Hodel) wrote:
> Neither (({Prime.each.reverse_sort.take 10})) nor (({Prime.each.sort.take 10})) will return as there is no last value for infinite streams.

Of course. But you are aware that Enumerable has a `sort` method that acts as a shortcut to `to_a.sort`?

> We need feedback from the submitter.  Without it this issue should be closed.

The relevant question here is "should there be a dedicated way to do a reverse sort". The question of where that method should be (Array or Enumerable) is accessory.

----------------------------------------
Feature #8422: add Enumerable#reverse_sort and Enumerable#reverse_sort_by
https://bugs.ruby-lang.org/issues/8422#change-39914

Author: Hanmac (Hans Mackowiak)
Status: Feedback
Priority: Normal
Assignee: 
Category: 
Target version: 


they are better when you want descending order,
  enum.sort.reverse
does work too, but it is to slow because it needs to build that result array twice

they both can be defined just like #sort and #sort_by but negates the result of the compare block


-- 
http://bugs.ruby-lang.org/