~/bend-docscommunity

src/batch.bend checks

raw source on the hub · import 0x53dde92df75268075f1bc6c33ecbb079/src/batch.bend as Batch

1 import
import Base

Types

type Batch source · line 4 · raw

@-A:Data -> Data

A reusable tree of rows. Internal nodes expose independent work to Bend.

Definitions

def count source · line 9 · raw

@-A:Data -> @rows:Batch<A> -> Nat

def build source · line 21 · raw

@-A:Data -> @+fuel:Nat -> @n:Nat -> @+xs:List<&2, A> -> Batch<A>

Split list ranges into a balanced tree; construction takes O(n log n). fuel bounds recursion; from_list supplies a sufficient bound (list length).

def from_list source · line 40 · raw

@-A:Data -> @+xs:List<&2, A> -> Batch<A>

def to_list source · line 44 · raw

@-A:Data -> @rows:Batch<A> -> List<&2, A>

Templates

template map source · line 54 · raw

@-A:Data -> @-B:Data -> @-f:(@_:A -> B) -> @rows:Batch<A> -> Batch<B>

Template callbacks are reusable and specialized at compile time.

template fold source · line 66 · raw

@-A:Data -> @-B:Data -> @-leaf:(@_:A -> B) -> @-join:(@_:B -> @_:B -> B) -> @+zero:B -> @rows:Batch<A> -> B

The join operation should have an identity zero and be associative in the intended arithmetic. F32 results can vary with grouping because of rounding.