Under heavy development. This site describes the intended 1.0 language. Current features and performance vary. Development status
Sn50SnThe SnAPI programming language
Development · Evolving reference

CallableAny

Consumes a cursor with a concrete exact-item safe predicate.

Sn is under heavy development. This reference includes the intended 1.0 design; features may be incomplete in the current compiler. Read the status →

Module std.iteration

import std.iteration;

Public declaration contracts and authored examples. A page can document several related symbols. Implementation bodies are excluded.

Any

pub fn Any<T, I, C>(mut Cursor: I, mut Predicate: C) -> bool
    where T: Copyable where I: TypedIterator<T>
    where C: UnaryCallable<T, bool>, Movable

Consumes a cursor with a concrete exact-item safe predicate.

Examines items in order, retaining each optional during invocation. Stops on the first match or exhaustion; empty input returns false. Owning discarded items use ordinary destruction; returned carriers preserve exact ownership/access. The terminal owns the callback and adds no allocation or synchronization. Callback costs and borrowed backing validity remain its contract; no capture backing is retained implicitly. T: Exact Copyable input item type. I: Structural source cursor, inferred from Cursor. C: Concrete Movable safe predicate, inferred from Predicate. Cursor: Owned traversal state; explicitly move non-Copy named cursors. Predicate: Owned environment; borrowed captures must survive traversal. Return: Short-circuit boolean result; unexamined items remain unpulled. Warning: Infinite traversal without a decisive predicate result never terminates.

Any

pub fn Any<T, I, C>(mut Cursor: I, mut Predicate: C) -> bool
    where T: Movable where I: TypedIterator<T>
    where C: BorrowingUnaryCallable<T, bool>, Movable

Consumes a cursor with a concrete readonly-borrowing safe predicate.

Examines items in order, retaining each optional during invocation. Stops on the first match or exhaustion; empty input returns false. Owning discarded items use ordinary destruction; returned carriers preserve exact ownership/access. The terminal owns the callback and adds no allocation or synchronization. Callback costs and borrowed backing validity remain its contract; no capture backing is retained implicitly. T: Exact Movable input item type. I: Structural source cursor, inferred from Cursor. C: Concrete Movable safe predicate, inferred from Predicate. Cursor: Owned traversal state; explicitly move non-Copy named cursors. Predicate: Owned environment; borrowed captures must survive traversal. Return: Short-circuit boolean result; unexamined items remain unpulled. Warning: Infinite traversal without a decisive predicate result never terminates.

Documentation snapshot: October 24, 2026 About versions ↗
Searching Development · language & standard library