Coloring for Colorblindness (2018)
davidmathlogic.com1 pointsby AprilArcus0 comments
function * makeSequence() {
let i = 1;
while (true) yield i++;
}
This function returns an iterator: const ints = makeSequence();
And now the caller is control of iteration, not the callee: function sumTo(cutoff) {
const ints = makeSequence();
let sum = 0;
for (let i = 0; i < cutoff; i++) {
sum += ints.next().value;
}
return sum;
}
In this case there is no risk of an infinite loop.
RGBY televisions do exist, but their goal is to boost brightness in the yellow region, not color gamut.