I'm looking for something like
val allInts = (1..).asSequence()
so I could, for example
allInts.take(5)
I'm looking for something like
val allInts = (1..).asSequence()
so I could, for example
allInts.take(5)
val sequence = generateSequence(1) { it + 1 }
val taken = sequence.take(5);
taken.forEach { println(it) }
但这并不是无限的:当整数为整数时,它会溢出.已达到最大值.