Another update from ingydotnet^djgoku

This commit is contained in:
Ingy döt Net 2015-11-18 06:14:39 +00:00
parent 91df62d461
commit 948b86eafa
7604 changed files with 108452 additions and 22726 deletions

View file

@ -0,0 +1,15 @@
function a(k, x1, x2, x3, x4, x5) {
function b() {
k -= 1;
return a(k, b, x1, x2, x3, x4);
}
return (k > 0) ? b() : x4() + x5();
}
// 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)));

View file

@ -0,0 +1,6 @@
var x = n => () => n;
var a = (k, x1, x2, x3, x4, x5) => {
var b = () => return a(--k, b, x1, x2, x3, x4); //decrement k before use
return (k > 0) ? b() : x4() + x5();
};

View file

@ -1,15 +0,0 @@
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();
}
// 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)));