# Redundant sort / sortperm options: why?

**URL:** <https://discourse.julialang.org/t/redundant-sort-sortperm-options-why/5631>\
**Category:** General Usage\
**Tags:** sort, sortperm\
**Created:** [August 30, 2017, 3:35pm UTC](https://discourse.julialang.org/t/redundant-sort-sortperm-options-why/5631 "2017-08-30T15:35:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![anon94023334](https://avatars.discourse-cdn.com/v4/letter/a/e274bd/32.png) [@anon94023334](https://discourse.julialang.org/u/anon94023334)\
**Post date:** [August 30, 2017, 3:35pm UTC](https://discourse.julialang.org/t/redundant-sort-sortperm-options-why/5631/1 "2017-08-30T15:35:23Z")

</div>

`sort` and `sortperm` take a couple of keyword arguments that appear to be redundant (at least, one of them is a subset of the other): `rev` and `order`. That is:

```julia
julia> sortperm(a, rev=true) == sortperm(a, order=Base.Order.Reverse)
true

julia> sortperm(a) == sortperm(a, rev=true, order=Base.Order.Reverse)
true

```

Benchmarking suggests no advantage to one over the other.

Is the idea that a custom sorting algorithm (via `order`) can be automatically reversed with the `rev` keyword? If not, what is the purpose of having both `rev` and `order`?

---

<div class="post-metadata">

**Author:** ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)\
**Post date:** [August 30, 2017, 3:44pm UTC](https://discourse.julialang.org/t/redundant-sort-sortperm-options-why/5631/2 "2017-08-30T15:44:15Z")

</div>

[https://github.com/JuliaLang/julia/issues/22382#issuecomment-308732349](https://github.com/JuliaLang/julia/issues/22382#issuecomment-308732349), [https://github.com/JuliaLang/julia/pull/22388](https://github.com/JuliaLang/julia/pull/22388) etc

---

<div class="post-metadata">

**Author:** ![xiaodai](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/xiaodai/32/15937_2.png) [@xiaodai](https://discourse.julialang.org/u/xiaodai)\
**Post date:** [January 1, 2018, 1:26pm UTC](https://discourse.julialang.org/t/redundant-sort-sortperm-options-why/5631/3 "2018-01-01T13:26:01Z")

</div>

Ok. Sounds like Ordering is here to stay after reading the github issues.

I think it’s quite a bit more complicated than setting a rev = true/false. Would love a simple blog post to explain what all the Ordering options are about.
