Slide 39
Slide 39 text
func fibGenerator*() -> Int {
var i = 0, j = 1
repeat {
let next = i + j
yield next
(i, j) = (j, next)
} while true
}
fibGenerator() // returns 1
fibGenerator() // returns 2
fibGenerator() // returns 3
fibGenerator() // returns 5