fold

inline fun <ID : Any, T, R> Field<ID, T>.fold(initial: R, crossinline accumulator: Accumulator<R, FieldEntry<ID, T>>): R

Accumulates a result starting from initial, by applying accumulator to each field entry (excluding the local one).

This function behaves like a fold over the entries of the field, skipping the local element.

Return

the final accumulated result.

Parameters

initial

the initial value for the accumulation.

accumulator

the function that combines the current accumulator value with each field entry.