-
Notifications
You must be signed in to change notification settings - Fork 0
/
cps_01.js
24 lines (23 loc) · 835 Bytes
/
cps_01.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// start to trace the calls, which finally generates the first output
function yinyang_cps_01() {
// rename the variable to prevent confusing shadowing
const yin = ((yin2) => { // renamed: yin -> yin2
process.stdout.write("@");
((yang) => {
process.stdout.write("*");
yin2(yang); // renamed: yin -> yin2
})((yang) => {
process.stdout.write("*");
yin2(yang); // renamed: yin -> yin2
});
});
process.stdout.write("@"); // output 1
((yang) => {
process.stdout.write("*");
yin(yang);
})((yang) => {
process.stdout.write("*");
yin(yang);
}); // next step: plug this not-so-giant "parameter" from line 18 to line 21 into the function at line 15
}
yinyang_cps_01(); // output: @*@**@***@****@*****@...