Skip to reference

std.x.list_eq

wolf-std d58f9e1 · toolchain pin verified against wolf 0.2.41 (0261597). Source signatures and documentation; execution support is stated in each module.

All modules · Plain text · Stability tier: x

Module

std.x.list_eq — the six element-comparing std.list functions, parked outside the facade. Stability tier: x (nursery, D31 clock: they graduate INTO std.list verbatim, or are deleted, at the stdc01 closeout).

Why they are here and not in std.list, in one sentence: comparing elements needs cmp.Eq, importing std.cmp drags its trait and enum items into every importer, and wolfc's checked tier answers unsupported — module items in checked execution for those items — which would flip EVERY std.list test's wolfc row from run to unsupported (F-0012). Budgeting a module by its worst body is house doctrine (sc01), so the six wait here where the cost is contained.

The second blocker is the older one: neither implementation EXECUTES trait dispatch, so every test in tests/x/list_eq/ is ledgered unsupported/unsupported (F-0002, F-0004). The bodies still earn their keep — they typecheck through wolfc's mem rung with the bound satisfied, which is the evidence that the signatures are writable at all.

Absence is spelled none, which is the convention's own spelling as of sc06 — F-0003 is dead and "pending" was stale prose for six sprints after the rename. The bodies read through the local len/at helpers because std.list's single-read rule required it when they were written; that rule died at the sc11 pin (s72's D40, F-0005 and F-0014 closed), and the shape survives as correct-and-not-worth-churning rather than as law.

Types and traits

No public declarations in this section.

Functions and methods

contains

fn · Source line 51

pub fn contains[T: cmp.Eq](xs: List[T], v: T) -> bool

Whether any element of xs equals v under Eq. Total: no error row, no traps.

Prose, not a fenced example (§4): neither implementation executes trait dispatch at the current pins, so a runnable example would be a doc bug. contains(xs, 2) is true for the list [1, 2], and false for [1, 3] — the equality is Eq.eq's, never =='s (F-0004 keeps the operator bridge a filing, not an assumption).

index_of

fn · Source line 66

pub fn index_of[T: cmp.Eq](xs: List[T], v: T) -> int ! {none}

The index of the first element equal to v under Eq; none when no element matches. No traps.

Prose, not a fenced example (§4, trait dispatch — F-0002): for [5, 6, 5], index_of(xs, 5) is 0 and index_of(xs, 9) raises none.

last_index_of

fn · Source line 83

pub fn last_index_of[T: cmp.Eq](xs: List[T], v: T) -> int ! {none}

The index of the LAST element equal to v under Eq; none when no element matches. No traps.

Prose, not a fenced example (§4, trait dispatch — F-0002): for [5, 6, 5], last_index_of(xs, 5) is 2.

dedup

fn · Source line 102

pub fn dedup[T: cmp.Eq](mut xs: List[T])

Collapses runs of CONSECUTIVE equal elements (under Eq) to one, in place — the sorted-input companion, not a set builder. Total: no error row, no traps.

Prose, not a fenced example (§4, trait dispatch — F-0002): [1, 1, 2, 1] dedups to [1, 2, 1]; sort first if you want uniqueness.

starts_with

fn · Source line 127

pub fn starts_with[T: cmp.Eq](xs: List[T], prefix: List[T]) -> bool

Whether xs begins with every element of prefix, in order, under Eq; an empty prefix is always a prefix. Total: no error row, no traps.

Prose, not a fenced example (§4, trait dispatch — F-0002): [1, 2, 3] starts with [1, 2] and does not start with [2].

ends_with

fn · Source line 149

pub fn ends_with[T: cmp.Eq](xs: List[T], suffix: List[T]) -> bool

Whether xs ends with every element of suffix, in order, under Eq; an empty suffix is always a suffix. Total: no error row, no traps.

Prose, not a fenced example (§4, trait dispatch — F-0002): [1, 2, 3] ends with [2, 3] and does not end with [3, 2].

Constants

No public declarations in this section.

Errors and row tags

Tags named by public signatures: none. Their conditions are documented on the functions that return them.

No public declarations in this section.