Skip to main content

Module pick

Module pick 

Source
Expand description

pick — branched-dispatch primitive (SRD-66 §“Surface 3”).

Signature: pick(b0, b1, …, bN-1, v0, v1, …, vN-1) -> V

Exactly one of the N selector booleans must be true at eval; the corresponding value is returned. Zero true and multiple-true both panic with a clear diagnostic — workload authors get a hard signal when their probe assumptions break, never a silent default.

The split-halves call shape (all booleans first, then all values) was chosen over interleaved pairs so long lists scan cleanly and a missing pair surfaces as “odd total args” at compile time. See SRD-66 §“Why not pair-wise (b, v) interleaving?” for rationale.

Structs§

Pick
Branched-dispatch primitive: select the value whose paired selector is true. SRD-80b split-halves variadic — the macro recognises two consecutive &[T] variadic args as a split-halves shape, emits selectors.len() Bool slots followed by values.len() polymorphic slots (each pair (b_i, v_i) shares an index), and slices inputs at the midpoint at eval time.