kumulant

group

inline fun <K, S : GroupedStat> group(name: String, keys: K, build: (K) -> S): BoundStat<GroupResult, S, GroupStatKey<K>>(source)

Build a nested-group BoundStat. build is invoked with keys (the sub-schema's key handle) and must return a GroupedStat; typically a StatGroup constructed against that sub-schema. The resulting BoundStat uses a GroupStatKey so dotted lookup result[outerKey][innerKey] compiles.

stat

fun <R : Result, S : Stat<R>> stat(name: String, value: S): BoundStat<R, S, StatKey<R>>(source)

Build a BoundStat from a string name and a live stat. Convenience for ad-hoc groups: BoundStat(StatKey(name), value) with type inference.

Prefer the StatSchema declarators when registering stats at schema construction time; they produce typed StatKeys as delegate properties for compile-time-safe lookup.


fun <R : Result, S : Stat<R>, K : StatKey<R>> stat(key: K, value: S): BoundStat<R, S, K>(source)

Build a BoundStat from an existing StatKey and a live stat. Used when the key was created elsewhere (e.g. via a StatSchema declarator) and you want to pair it with a specific live instance; common in tests and in materializer code paths.