3 ms·
Or you can go all the way in the other direction (double- or triple-barreled CPS) and have functions that can't return but only call other functions. let f
by Joker_vD 3y ago
Or you can go all the way in the other direction (double- or triple-barreled CPS) and have functions that can't return but only call other functions.
let fizzbuzz = func(ret, fizzbuzz, x, max) {
(x == max)(ret, func() {
let printed = false;
(x % 3)(func (t0) {
let k0 = func() {
(x % 5)(func (t1) {
let k1 = func() {
let k2 = func() {
(x + 1)(func (t2) {
fizzbuzz(ret, fizzbuzz, t2, max);
})
};
(printed == false)(func () {
print(k2, x);
}, k2);
};
(t1 == 0)(func () {
print(func() {
printed = true;
k1();
}, "buzz");
}, k1);
});
};
(t0 == 0)(func() {
print(func() {
printed = true;
k0();
}, "fizz");
}, k0);
});
});
}
fizzbuzz($halt, fizzbuzz, 0, 100);
- quickthrower2 3y agoIs this a slightly less esoteric version of the Lambda calculus?
- abecedarius 3y agoRaph Levien's Io was along those lines (but conciser). (Different language than a newer now better-known Io.)