Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
15
Task/Man-or-boy-test/JavaScript/man-or-boy-test-1.js
Normal file
15
Task/Man-or-boy-test/JavaScript/man-or-boy-test-1.js
Normal 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)));
|
||||
6
Task/Man-or-boy-test/JavaScript/man-or-boy-test-2.js
Normal file
6
Task/Man-or-boy-test/JavaScript/man-or-boy-test-2.js
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
var x = n => () => n;
|
||||
|
||||
var a = (k, x1, x2, x3, x4, x5) => {
|
||||
var b = () => a(--k, b, x1, x2, x3, x4); //decrement k before use
|
||||
return (k > 0) ? b() : x4() + x5();
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue