std.list [core] std.list.push pub fn push[T](mut xs: List[T], v: T) — Appends v to the end of xs, growing it. std.list.pop pub fn pop[T](mut xs: List[T]) -> T ! {none} — Removes and returns the last element; none when xs is empty — the absence row, consumed by else or ?. std.list.len pub fn len[T](xs: List[T]) -> int — The number of elements in xs. std.list.is_empty pub fn is_empty[T](xs: List[T]) -> bool — Whether xs holds no elements — len(xs) == 0, spelled as the predicate callers reach for (§1). std.list.get pub fn get[T](xs: List[T], i: int) -> T ! {none} — The element at i, checked: none when i is negative or at least len(xs) — the one checked-access spelling (§1: no get_ prefix, no sentinel). std.list.set pub fn set[T](mut xs: List[T], i: int, v: T) — Replaces the element at i with v, in place. std.list.first pub fn first[T](xs: List[T]) -> T ! {none} — The first element; none when xs is empty. std.list.last pub fn last[T](xs: List[T]) -> T ! {none} — The last element; none when xs is empty. std.list.insert pub fn insert[T](mut xs: List[T], i: int, v: T) — Inserts v at i, shifting the elements from i onward one place to the right; i == len(xs) appends. std.list.remove pub fn remove[T](mut xs: List[T], i: int) -> T — Removes the element at i, shifting the rest left, and returns it. std.list.swap_remove pub fn swap_remove[T](mut xs: List[T], i: int) -> T — Removes the element at i by moving the LAST element into its slot, and returns the removed element. std.list.swap pub fn swap[T](mut xs: List[T], i: int, j: int) — Exchanges the elements at i and j, in place; i == j is a no-op. std.list.clear pub fn clear[T](mut xs: List[T]) — Empties xs, keeping it usable. std.list.truncate pub fn truncate[T](mut xs: List[T], n: int) — Shortens xs to at most n elements, dropping the tail; a n at or above len(xs) leaves it alone and a negative n empties it. std.list.reverse pub fn reverse[T](mut xs: List[T]) — Reverses xs in place. std.list.extend pub fn extend[T](mut xs: List[T], other: List[T]) — Appends every element of other to xs, in order. std.list.concat pub fn concat[T](a: List[T], b: List[T]) -> List[T] — A new list holding a's elements followed by b's; both operands are read, not consumed (to_-style allocation, §1). std.list.fill pub fn fill[T](mut xs: List[T], v: T) — Overwrites every element of xs with v, keeping its length. std.list.repeat pub fn repeat[T](xs: List[T], n: int) -> List[T] — A new list with xs's elements repeated n times; n <= 0 yields an empty list. std.list.any pub fn any[T](xs: List[T], pred: fn(T) -> bool) -> bool — Does pred hold for ANY element? std.list.all pub fn all[T](xs: List[T], pred: fn(T) -> bool) -> bool — Does pred hold for EVERY element? std.list.count_where pub fn count_where[T](xs: List[T], pred: fn(T) -> bool) -> int — How many elements satisfy pred. std.list.index_where pub fn index_where[T](xs: List[T], pred: fn(T) -> bool) -> int ! {none} — The index of the FIRST element satisfying pred; none when none does. std.list.find_where pub fn find_where[T](xs: List[T], pred: fn(T) -> bool) -> T ! {none} — The first element satisfying pred; none when none does. std.list.min_by pub fn min_by[T](xs: List[T], better: fn(T, T) -> bool) -> T ! {none} — The BEST element under better, where better(a, b) reads "a is better than b": the first element such that no later one beats it. std.list.max_by pub fn max_by[T](xs: List[T], better: fn(T, T) -> bool) -> T ! {none} — min_by under the flipped relation, named for the call sites that read better with it. std.list.is_sorted_by pub fn is_sorted_by[T](xs: List[T], le: fn(T, T) -> bool) -> bool — Is xs sorted under le, where le(a, b) reads "a may precede b"? std.list.map pub fn map[T, U](xs: List[T], f: fn(T) -> U) -> List[U] — A new list holding f(x) for every x in xs, in order; xs is read, not consumed. std.list.filter pub fn filter[T](xs: List[T], keep: fn(T) -> bool) -> List[T] — A new list holding the elements of xs for which keep holds, in their original order; xs is read, not consumed. std.list.fold pub fn fold[T, A](xs: List[T], init: A, step: fn(A, T) -> A) -> A — Combines every element of xs into one value, left to right: f(… f(f(init, x0), x1) …, xn). std.list.sum pub fn sum(xs: List[int]) -> int — The sum of xs; 0 for the empty list. std.list.enumerate pub fn enumerate[T](xs: List[T]) -> List[(int, T)] — A new list pairing each element of xs with its index, in order: (0, x0), (1, x1), …. std.list.zip pub fn zip[T, U](xs: List[T], ys: List[U]) -> List[(T, U)] — A new list pairing the elements of xs and ys position by position: (x0, y0), (x1, y1), …, as long as the SHORTER of the two, so the longer list's tail is dropped rather than trapped on. std.list.sort_by pub fn sort_by[T](mut xs: List[T], less: fn(T, T) -> bool) — Sorts xs in place, stably, under less, where less(a, b) reads "a goes before b". std.list.sorted_by pub fn sorted_by[T](xs: List[T], less: fn(T, T) -> bool) -> List[T] — sort_by's returning twin: a fresh list holding xs's elements in less's order, stably, with xs untouched. std.list.sorted pub fn sorted[T: cmp.Ord](xs: List[T]) -> List[T] — A fresh list holding xs's elements in T's own ascending order, stably, with xs untouched.