pub enum SeqVerbOp {
Map,
Filter,
Fold,
FilterMap,
Each,
MapEach,
}Expand description
The fn-value verb selected by an Opcode::SeqVerb instruction’s kind
byte (docs/stdlib-spec.md §4, issue #1679).
The pure quartet: map, filter, fold, filter_map. Callbacks are
pure·silent by the 2026-07-18 ruling, which is what dissolves the
eager/lazy question — “one logical pass, order unobservable; the
implementation may fuse freely.” Every kind evaluates its callback
re-entrantly with output isolated, the SeqSortedBy shape; a callback
that yields, presents a choice, calls a host external, or diverges is a
turn-terminating fault.
The ruled effectful spellings: each, map_each. Slice 2 of the
same issue — deliberately the opposite runtime contract: output reaches
the transcript instead of being captured, and the dev-mode world-write
guard is disarmed for their callback (docs/stdlib-spec.md §4: “the weird
thing gets the ugly method” — friction lives in the name, not in an
enforcement gate). Sequential in iteration order, never fused. They are
deliberately NOT gated by E119 (brink_analyzer::comparator_contract) —
their whole purpose is to be the legal home for the effects the pure
quartet’s callbacks may not perform.
Variants§
Map
[a, f] → [a'] — the array of f(x) for each element, in
iteration order. f: fn(T): U.
Filter
[a, pred] → [a'] — the elements for which pred(x) is true,
in iteration order. pred: fn(T): bool; a non-bool return is a
turn-terminating fault.
Fold
[a, init, f] → [acc] — left fold: acc starts at init and
becomes f(acc, x) for each element in iteration order.
f: fn(U, T): U.
FilterMap
[a, f] → [a'] — the Option-mapper: f(x) for each element, kept
unwrapped when some(v), dropped when none, in iteration order.
f: fn(T): Option[U]; a non-Option return is a turn-terminating
fault. Still pure·silent-required — the natural companion of map
under the §1.4 Option ruling, not a relaxation.
Each
[a, f] → [null] — the effectful “do something per element, no
result” spelling: f(x) runs for each element, in iteration order,
for its side effects; the return value is discarded. f: fn(T).
Effectful: writes and emitted output are legal.
MapEach
[a, f] → [a'] — the effectful transform: the array of f(x) for
each element, in iteration order, sequential and never fused; f
may write/emit. f: fn(T): U. map’s ugly, honest twin.
Implementations§
Source§impl SeqVerbOp
impl SeqVerbOp
Sourcepub fn mnemonic(self) -> &'static str
pub fn mnemonic(self) -> &'static str
The source spelling of this verb — also the .inkt mnemonic and the
program_model disassembly text, and the verb name runtime faults
report. Stable, boring, snake_case.
Sourcepub fn is_effectful(self) -> bool
pub fn is_effectful(self) -> bool
Whether this verb’s callback runs under the pure·silent contract
(E119-gated, output captured, dev-mode world-write guard armed) or
the effectful contract (each/map_each: output reaches the
transcript, writes are legal). The VM’s seq_map/seq_filter/
seq_fold/seq_filter_map/seq_each/seq_map_each each read this
directly when entering their callback scope
(enter_callback_scope(flow, VERB, op.is_effectful())), so it
single-sources the classification guard_comparator_write’s posture
ultimately keys off — there is exactly one place a new SeqVerbOp
variant’s pure/effectful contract can be gotten wrong.
Sourcepub fn from_mnemonic(s: &str) -> Option<Self>
pub fn from_mnemonic(s: &str) -> Option<Self>
Inverse of mnemonic for the .inkt reader.