The values can also be retrieved in groups. For example, you can take a group of values at once:
val firstFive = sequence.take(5)
println(firstFive.joinToString())
This will print the first five values separated by comma:
Notice that take() is an intermediate operation, so it returns a Sequence<T> that will be actually calculated at a later time—when a terminal operation in invoked. So, in our example, calling take(5) will not actually have the sequence yield the values, but calling joinToString() will.