OxL Reference

method List.sort

Stable sort by the natural order (Ord).

Example:

oxl✓ checked in CI
fn main() io {
  print("{[7, 8].first()} {List<i32>.new().first()}")
}
Output
7 none

Example:

oxl✓ checked in CI
fn main() io {
  let a = [1, 2]
  var b = a.clone()
  b.push(3)
  print("{a} {b}")
}
Output
[1, 2] [1, 2, 3]

Example:

oxl✓ checked in CI
fn main() io {
  var xs = [3, 1, 2]
  xs.sort()
  print("{xs}")
}
Output
[1, 2, 3]
pub(api) var fn sort()

Since. 1.0.0-beta

Effects

none declared (pure unless the body says otherwise)

Defined in: std/core/collections.oxl:363

See also