# Proposal idea: descending sort

**URL:** <https://es.discourse.group/t/proposal-idea-descending-sort/889>\
**Category:** 🦋 Proposals\
**Created:** [July 26, 2021, 9:02pm UTC](https://es.discourse.group/t/proposal-idea-descending-sort/889 "2021-07-26T21:02:50Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![bakkot](https://yyz2.discourse-cdn.com/free1/user_avatar/es.discourse.group/bakkot/32/22_2.png) [@bakkot](https://es.discourse.group/u/bakkot)\
**Post date:** [December 6, 2024, 6:43pm UTC](https://es.discourse.group/t/proposal-idea-descending-sort/889/7 "2024-12-06T18:43:58Z")

</div>

Yeah, a function to reverse a comparison function is much more natural.

That's what [Java](https://docs.oracle.com/javase/8/docs/api/java/util/Comparator.html#reversed--) and [Rust](https://doc.rust-lang.org/std/cmp/struct.Reverse.html) do, for example.

Only problem is where to put it. Function.prototype is kind of a weird place though I guess it would work. But I also think we should have some more built-in comparison functions, like the standard numeric one, so maybe a new namespace like `Compare`? As in, `array.sort(Compare.numeric)` for ascend sorting by numeric order, `array.sort(Compare.reverse(Compare.numeric))` for descending sort.

---

_[View the full topic](https://es.discourse.group/t/proposal-idea-descending-sort/889)._
