1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
var arr = []; function f() {} function g(n, h) { var a = f; if (n <= 0) return f; var t = g(n - 1, h); var r = function(x) { if (x) return a; return a(h(function() { return t(); })); }; arr.push(r); return r; } g(80, f); g(80, f); g(80, f); for (var i = 0; i < arr.length; i++) assertEq(arr[i](1), f);