|
|
|
|
|
by TweedHeads
6136 days ago
|
|
Full anonimity, thanks to tilly (separated for better understanding): builder = function(x){ return function(n){ return x(x)(n); }}
factorial = function(f){ return function(n){ return n==0?1:n*f(f)(n-1);} }
alert(builder(factorial)(8))
One liner, just seed factorial to builder: r = (function(x){ return function(n){ return x(x)(n); } } (function(f){ return function(n){ return n==0?1:n*f(f)(n-1);} }))(8);
|
|