OxL Reference

method iter.sortByDesc

Stable descending sort by key.

Example:

oxl✓ checked in CI
fn main() io {
  print("{["fig", "apple", "kiwi"].iter().sortByDesc(s => s.len()).collect()}")
}
Output
["apple", "kiwi", "fig"]
pub(api) move fn sortByDesc<K: Ord, effect F>(key: fn(T) -> K F escaping) -> iter<T>  F

Complexity. O(n log n); the whole input is pulled at the first pull.

Since. 1.0.0-beta

Parameters

NameType
keyfn(T) -> K F escaping

Returns

iter<T> F

Effects

none declared (pure unless the body says otherwise)

Defined in: std/core/iter.oxl:526

See also