/** * `` — one number for the WHOLE run, on every row. * * `accumulate=` totals a list inside one record. `` totals a * column as it goes, so row i knows about rows 1..i. This is the third and last * axis: a row that knows something about EVERY row, including the ones after it. * * * * * * * * * "Is this row above average" cannot be asked any other way: the average is not * knowable until the last row exists, and a conditional gen is evaluated while * the row is being built. * * ── What it costs, said out loud ────────────────────────────────────────────── * * A statistic over the whole run is the strongest form of the thing `running` * already is: it cannot be answered one row at a time, and unlike `running` it * cannot even be answered by the rows SO FAR. So the streaming builder refuses * it by name and the router hands the config to the in-memory engine — the same * road `running`, `uniq` on a composed value and every other whole-column * construct takes. * * ── Where the arithmetic comes from ─────────────────────────────────────────── * * `sum`, `min` and `max` are the last value of the corresponding RUNNING column, * computed by {@link accumulateColumn}. That is not a shortcut — it is how the * two features are kept from drifting: the fixed-point scale rule, the treatment * of an empty cell and the "min returns the winning element's own spelling" rule * are written once and used twice. A column of `19.99`s totals to the same bytes * whether it is read row by row or all at once. * * `mean`, `median` and `stddev` are ratios and cannot be exact, so they are * computed in floating point over the numeric values — the same three formulas * the expression language's list functions use, including the POPULATION * standard deviation. `decimals=` rounds the answer; without it the full value * is printed, because a mean that quietly lost digits is worse than an ugly one. */ import type { Sequence, SequenceSpec } from './types.js'; /** What a statistic can be. */ export type StatOp = 'sum' | 'mean' | 'median' | 'min' | 'max' | 'count' | 'stddev'; export declare const STAT_OPS: readonly StatOp[]; export declare class StatError extends Error { readonly name = "StatError"; } /** The column a statistic reads, or `''` when the generator did not say. */ export declare function statOf(spec: SequenceSpec): string; /** * Read `op=` where an unknown op simply means "none". * * The engine path uses this one: by the time a value is drawn the validator has * already refused a misspelled op, so throwing here would turn a reported * problem into a crash. */ export declare function readStatOp(attrs: Record): StatOp | undefined; /** The same, but strict — the validator's copy, which turns a bad op into a diagnostic. */ export declare function parseStatOp(attrs: Record): StatOp | undefined; /** `decimals=`, or undefined when the answer is printed at full precision. */ export declare function statDecimals(attrs: Record): number | undefined; /** * The statistic itself, as the text that goes in every cell. * * A cell the parent filter emptied does not take part — the same rule * `accumulateColumn` follows, so a filtered column has one meaning across the * three features rather than three. */ export declare function statisticOf(values: readonly (string | undefined)[], op: StatOp, decimals: number | undefined): string; /** * Publish the statistic column. * * Reads `of=` out of the registry rather than drawing anything: a statistic * consumes no randomness at all, which is why adding one leaves every other * column exactly where it was. */ export declare function registerStat(spec: SequenceSpec, registry: Record, count: number): void; //# sourceMappingURL=stat.d.ts.map