Documentation / dataflow-async / com.femastudios.dataflow.async.extensions / fold
Go to reference

fold

fun <T, K, R> Attribute<Grouping<T, K>>.fold(initialValue: R, operation: (accumulator: R, element: T) -> R): Attribute<Map<K, R>>
fun <T, K, R> Attribute<Grouping<T, K>>.fold(initialValue: Attribute<R>, operation: (accumulator: R, element: T) -> R): Attribute<Map<K, R>>
fun <T, K, R> Attribute<Grouping<T, K>>.fold(initialValueSelector: (key: K, element: T) -> R, operation: (key: K, accumulator: R, element: T) -> R): Attribute<Map<K, R>>
fun <T, R> Attribute<Iterable<T>>.fold(initial: R, operation: (acc: R, T) -> R): Attribute<R>
fun <T, R> Attribute<Iterable<T>>.fold(initial: Attribute<R>, operation: (acc: R, T) -> R): Attribute<R>

Same as fold, but accepts Attribute and returns a new Attribute.

Calling this function is equivalent to use transform and calling fold in the transformation function.

This is simply a convenience function.

See Also

kotlin.collections.fold


fun <T, R> Attribute<Sequence<T>>.fold(initial: R, operation: (acc: R, T) -> R): Attribute<R>
fun <T, R> Attribute<Sequence<T>>.fold(initial: Attribute<R>, operation: (acc: R, T) -> R): Attribute<R>

Same as fold, but accepts Attribute and returns a new Attribute.

Calling this function is equivalent to use transform and calling fold in the transformation function.

This is simply a convenience function.

See Also

kotlin.sequences.fold


fun <R> Attribute<String>.fold(initial: R, operation: (acc: R, Char) -> R): Attribute<R>
fun <R> Attribute<String>.fold(initial: Attribute<R>, operation: (acc: R, Char) -> R): Attribute<R>

Same as fold, but accepts Attribute and returns a new Attribute.

Calling this function is equivalent to use transform and calling fold in the transformation function.

This is simply a convenience function.

See Also

kotlin.text.fold