unfold

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

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

Type Parameters

E

the element type produced by unfolding

See also