July 2018
Intermediate to advanced
266 pages
7h 11m
English
The following is an initial implementation for a sequence that can yield the numbers on demand:
val fibonacci = buildSequence { yield(1) var current = 1 var next = 1 while (true) { yield(next) val tmpNext = current + next current = next next = tmpNext }}
The following is an explanation of how this code works:
Read now
Unlock full access