all tasks
This commit is contained in:
parent
b83f433714
commit
68f8f3e56b
14735 changed files with 178959 additions and 0 deletions
13
Task/Y-combinator/JavaScript/y-combinator-4.js
Normal file
13
Task/Y-combinator/JavaScript/y-combinator-4.js
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
function pseudoY(f) {
|
||||
return function g() {
|
||||
return f.apply(g, arguments);
|
||||
};
|
||||
}
|
||||
|
||||
var fac = pseudoY(function(n) {
|
||||
return n > 1 ? n * this(n - 1) : 1;
|
||||
});
|
||||
|
||||
var fib = pseudoY(function(n) {
|
||||
return n > 1 ? this(n - 1) + this(n - 2) : n;
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue