@pond-ts/process API Reference
    Preparing search index...

    Interface FoldContext

    interface FoldContext {
        at: (index: number) => number;
        id: string;
        params: Params;
        values: Readonly<Record<string, readonly (number | undefined)[]>>;
        numeric(role: string): ColumnView | undefined;
    }
    Index

    Properties

    Methods

    Properties

    at: (index: number) => number

    Timestamp at a row index.

    A function rather than an array because a fold reports two or three rows out of 150,000, and materializing the key column to answer that was most of what a reduction used to cost.

    id: string

    This fold's id — the fact's own cache key and citation.

    params: Params
    values: Readonly<Record<string, readonly (number | undefined)[]>>

    Dense values per input role, gaps as undefined.

    Prepared by the graph rather than by each fold, and — the point of the original exercise — prepared inside the memo, so densifying a 150,000-row column happens once per version rather than once per request.

    Prefer FoldContext.numeric. This is the boxed form, and it is now lazy: touching a role allocates an Array of that column's length and fills it, which is the single largest heap cost in the graph ([PND-PROCCOL]). latest reads one cell and used to pay for 500,000 of them. Untouched roles cost nothing, so a fold that never reads this never allocates.

    Methods

    • A zero-copy columnar view of one input role — no allocation, at any length.

      values is the column's own storage and a cell is meaningful only where defined(i); both are borrowed and must not be retained past the fold. undefined when the role's column is not packed numeric (a string column, or a value an op returned boxed), which is the caller's cue to fall back to FoldContext.values.

      Reading is not faster this way — a buffer walk reaches parity with the boxed array and Column.scan() is 4.7× slower than either. What changes is that nothing is allocated to do it.

      Parameters

      • role: string

      Returns ColumnView | undefined