unfold

fun <E> E.unfold(extractor: (E) -> Sequence<E>): Sequence<E>(source)

The opposite of fold.

Receiver

The starting element to unfold.

Return

A sequence of E generated by unfolding on each element provided by the extractor function.

Parameters

extractor

A function that provides a sequence of elements given a specific element of the same type.

See also