Every story and comment from the Hacker News API, in a layout borrowed from 2001.
A comment on Crafting Interpreters: Classes. Parent comment
Any ideas on how to make it run?
fun A (k, x1, x2, x3, x4, x5) { print k; fun B() { k = k - 1; return A(k, B, x1, x2, x3, x4); } if (k <= 0) { return x4() + x5(); } else { return B(); } }
fun F(i) { fun G() { return i; } return G; }
print A(10, F(1), F(-1), F(-1), F(1), F(0)); // expect: -67
There are no comments on this comment yet.
Any ideas on how to make it run?
fun A (k, x1, x2, x3, x4, x5) { print k; fun B() { k = k - 1; return A(k, B, x1, x2, x3, x4); } if (k <= 0) { return x4() + x5(); } else { return B(); } }
fun F(i) { fun G() { return i; } return G; }
print A(10, F(1), F(-1), F(-1), F(1), F(0)); // expect: -67