-
Notifications
You must be signed in to change notification settings - Fork 0
/
cps_03.js
32 lines (31 loc) · 991 Bytes
/
cps_03.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
25
26
27
28
29
30
31
32
// continue...
function yinyang_cps_03() {
const yin = ((yin2) => {
process.stdout.write("@");
((yang) => {
process.stdout.write("*");
yin2(yang);
})((yang) => {
process.stdout.write("*");
yin2(yang);
});
});
process.stdout.write("@"); // output 1
const yang = ((yang2) => {
process.stdout.write("*");
yin(yang2);
})
process.stdout.write("*"); // output 2
// yin(yang);
// ^^^ expanded according to the definition of `yin` ^^^
// all `yin2` in `yin` are replaced by `yang`
process.stdout.write("@"); // output 3
((yang2) => { // renamed: yang -> yang2
process.stdout.write("*");
yang(yang2); // renamed: yang -> yang2
})((yang2) => { // renamed: yang -> yang2
process.stdout.write("*");
yang(yang2); // renamed: yang -> yang2
}); // next: expand this
}
yinyang_cps_03(); // output: @*@**@***@****@*****@...