Skip to content

std:collections/Array

Canonical occurrence: protos/lib/collections/Array.protos · Protos revision: e99b712ecf658a527b1fe82c8beba2c1286d8dc9.

Sequential and isolated-parallel algorithms over ordinary Arrays.

This page lists the complete mechanically observable top-level slot inventory required by D067. Authored documentation, when present, is canonical D062 prose; mechanical presence alone does not create a stability or compatibility promise.

Answers a fresh Array of the elements of a snapshot of array for which predicate(element) answers true, keeping source order. A result other than canonical true or false signals InvalidPredicateResult.

Answers the lowest index of a snapshot of array whose element satisfies predicate(element), or null when none does. Elements are tested in ascending order; a result other than canonical true or false signals InvalidPredicateResult.

Answers a fresh Array whose element i is transform(array[i]), applied to a snapshot of array in ascending index order.

Answers a Future of a fresh Array of the elements for which predicate(element, arguments...), evaluated in isolated parallel execution, answers true. Selection keeps source order. Outcomes are examined in ascending index order, so the lowest index whose predicate fails or answers something other than canonical true or false (InvalidPredicateResult) supplies the failure.

Answers a Future of the lowest index whose element satisfies predicate(element, arguments...), evaluated in isolated parallel execution, or null when none does. Indexes are decided in ascending logical order: a failure or non-Boolean result (InvalidPredicateResult) at a lower index defeats a later match, and work at higher indexes is cancelled once the outcome is decided.

Answers a Future of a fresh Array whose element i is worker(array[i], arguments...), evaluated in isolated parallel execution. Results keep source order; the lowest failing index supplies the failure.

Answers a Future of the reduction of the elements with reducer(left, right, arguments...), or null for an empty Array. Each round combines adjacent pairs (0,1), (2,3), … left to right in isolated parallel execution and carries an odd final value unchanged, so the parenthesization is fixed and a non-associative reducer stays deterministic. Within a round the leftmost failing pair supplies the failure, and no later round starts after a failure.

Answers a Future of a fresh Array with the elements stably sorted by less(left, right, arguments...). The result, comparator invocation order, and failures are exactly those of sort with the comparator (left, right) => less(left, right, arguments...), except that every comparator invocation runs in its own isolated parallel execution. The source Array is not mutated.

Folds a snapshot of array left to right with reducer(accumulator, element). An optional single initial value seeds the fold; without one, the first element does, and an empty Array answers null. More than one initial value signals an Error.

Answers a fresh Array with the elements of a snapshot of array stably sorted by less(left, right). A comparator result other than canonical true or false signals InvalidComparatorResult, and two elements each less than the other signal InvalidComparatorOrder. The source is not mutated.

Exact module source · Standard-library API · Standard library overview