This commit is contained in:
Ingy döt Net 2013-10-27 22:24:23 +00:00
parent 6f050a029e
commit 776bba907c
3887 changed files with 59894 additions and 7280 deletions

View file

@ -1,8 +1,15 @@
function A(k, x1, x2, x3, x4, x5) {
function B() A(--k, B, x1, x2, x3, x4);
return k <= 0 ? x4() + x5() : B();
function a(k, x1, x2, x3, x4, x5) {
function b() {
k = k - 1;
return a(k, b, x1, x2, x3, x4);
}
return k <= 0 ? x4() + x5() : b();
}
function K(n) function() n;
alert(A(10, K(1), K(-1), K(-1), K(1), K(0)));
// this uses lambda wrappers around the numeric arguments
function x(n) {
return function () {
return n;
};
}
alert(a(10, x(1), x(-1), x(-1), x(1), x(0)));