September 2017 Update

This commit is contained in:
Ingy döt Net 2017-09-23 10:01:46 +02:00
parent bba7bfd280
commit ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions

View file

@ -0,0 +1,20 @@
function* nPowerGen(n) {
let e = 0;
while (1) { e++ && (yield Math.pow(e, n)); }
}
function* filterGen(gS, gC, skip=0) {
let s = 0; // The square value
let c = 0; // The cube value
let n = 0; // A skip counter
while(1) {
s = gS.next().value;
s > c && (c = gC.next().value);
s == c ?
c = gC.next().value :
n++ && n > skip && (yield s);
}
}
const filtered = filterGen(nPowerGen(2), nPowerGen(3), skip=20);

View file

@ -0,0 +1,4 @@
// Generate the first 10 values
for (let n = 0; n < 10; n++) {
console.log(filtered.next().value)
}