Include a new yield-accept filterable form

This yield-accept form is evaluated as an expression which returns a filter-able set, in this case the integer ring [0, 9], which in turn evaluates to a value to be compared and returned in O( 1 ).

let nMax = 100

function* g(){
yield 0
}

function* g(){
yield 1
}

function* g(){
yield 2
}

function* g(){
yield 3
}

function* g(){
yield 4
}

function* g(){
yield 5
}

function* g(){
yield 6
}

function* g(){
yield 7
}

function* g(){
yield 8
}

function* g(){
yield 9
}

function* g2( v ) {
yield* Math.max( g(), 0 ) < v
}

let value = null
let done = null

do {
const { value, done } = g2( nMax ).next()
console.log( value )
nMax = value
} while( !done )

I'm confused; those first 10 functions g already are valid JS that evaluate to "just the last function g".

1 Like