init

inline fun <ID : Any, T, R> ReductionType.init(field: Field<ID, T>, default: R, crossinline self: (ID, T) -> R): R

Computes the initial value for a reduction, depending on whether the local value is included.

Return

the result of self if this is IncludingSelf, or default if ExcludingSelf.

Parameters

field

the field from which to extract the local ID and value.

default

the value to use if the local value is excluded.

self

a function that computes the initial value from the local ID and value.


inline fun <ID : Any, T, R> ReductionType.init(field: Field<ID, T>, default: R, crossinline self: (FieldEntry<ID, T>) -> R): R

Computes the initial value for a reduction using a FieldEntry, based on whether the local value is included.

Return

the result of self if this is IncludingSelf, or default if ExcludingSelf.

Parameters

field

the field from which to extract the local entry.

default

the value to use if the local value is excluded.

self

a function that computes the initial value from the local FieldEntry.