1 -- function closures are powerful
3 -- traditional fixed-point operator from functional programming
5 local a
= function (f
) return f(f
) end
15 -- factorial without recursion
18 if n
== 0 then return 1
19 else return n
*f(n
-1) end
23 factorial
= Y(F
) -- factorial is the fixed point of F
27 io
.write(x
,"! = ",factorial(x
),"\n")