Infrastructure · Primitives
Select
Generic selection of items from a set based on criteria
Definition
Mechanism
Deterministic Filter. Applies a Predicate Function P(x) to every element in Input Set S. Returns a new Subset S' containing only elements where P(x) is True. It filters a set based on specific inclusion criteria.
Preconditions
- Criterion is decidable for item type
- Input set is iterable
Postconditions
- Subset returned
Invariants
- Predicate Truth: For all x in Output, Criterion(x) must be True.
- Subset Property: Output must be a subset of Input (no new items created).
- Determinism: Same input set + same criteria = same output set.
Risks
Failure modes
Empty Result
No items satisfy the criterion (returns empty set).
Predicate Error
The criterion function fails or throws an error for specific inputs.
Relationships
Root pattern: builds on nothing in this library.
Used by
References
Root primitive for state modification
Immutable record of one agent's cast choice
Mind
Width-limited heuristic search
Society
Ingest only what is strictly necessary
Irrevocable selection from a set of options
Reference
Parameters
limitInteger, [1, 10000]- Max items to return
strategyEnum, {Filter, First}- Default: Filter. Random sampling is excluded — it would violate the Determinism invariant.
