removed slot operator (no longer needed) & class proto bug fix to use NewSlot by...
[vox.git] / examples / ycombinator.vx
blob685361944c997830675d7c68747e2e3d9ad8d20a
2 /* code 'borrowed' from the spidermonkey distribution (thanks!) */
4 function factorial(proc)
6     return function (n)
7     {
8         return (n <= 1) ? 1 : n * proc(n-1);
9     }
12 function Y(outer)
14     function inner(proc)
15     {
16         function apply(arg)
17         {
18             return proc(proc)(arg);
19         }
20         return outer(apply);
21     }
22     return inner(inner);
25 println("5! is " + Y(factorial)(5));