OxL Reference

method List.remove

Removes and returns the element at index i; later elements move one place down.

Example:

oxl✓ checked in CI
fn main() io {
  var xs = [10, 20, 30]
  let x = xs.remove(1)
  print("{x} {xs}")
}
Output
20 [10, 30]

Removes and returns the element at i. Panics when i is out of range.

Example:

oxl✓ checked in CI
fn main() io {
  var xs = ["a", "b", "c"]
  let b = xs.remove(1)
  print("{b} {xs}")
}
Output
b ["a", "c"]
pub(api) var fn remove(i: usize) -> T

Complexity. O(n) in the number of elements after `i`.

Since. 1.0.0-beta

Parameters

NameType
iusize

Returns

T

Effects

none declared (pure unless the body says otherwise)

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

See also