iterator(iter)
Return a zero-argument function that can be used to traverse the iterator iter
.
Each call to the returned function will result in the next value from the iterator.
When all values in the iterator run out, this function will return false
.
function f(x)
{ yield x+1
yield x+2 }
let g = iterator(f(10))
g()
// 11
g()
// 12
g()
// false