diff options
| author | Mitja Felicijan <mitja.felicijan@gmail.com> | 2026-01-21 22:52:54 +0100 |
|---|---|---|
| committer | Mitja Felicijan <mitja.felicijan@gmail.com> | 2026-01-21 22:52:54 +0100 |
| commit | dcacc00e3750300617ba6e16eb346713f91a783a (patch) | |
| tree | 38e2d4fb5ed9d119711d4295c6eda4b014af73fd /examples/redis-unstable/deps/lua/test/factorial.lua | |
| parent | 58dac10aeb8f5a041c46bddbeaf4c7966a99b998 (diff) | |
| download | crep-dcacc00e3750300617ba6e16eb346713f91a783a.tar.gz | |
Remove testing data
Diffstat (limited to 'examples/redis-unstable/deps/lua/test/factorial.lua')
| -rw-r--r-- | examples/redis-unstable/deps/lua/test/factorial.lua | 32 |
1 files changed, 0 insertions, 32 deletions
diff --git a/examples/redis-unstable/deps/lua/test/factorial.lua b/examples/redis-unstable/deps/lua/test/factorial.lua deleted file mode 100644 index 7c4cf0f..0000000 --- a/examples/redis-unstable/deps/lua/test/factorial.lua +++ /dev/null @@ -1,32 +0,0 @@ --- function closures are powerful - --- traditional fixed-point operator from functional programming -Y = function (g) - local a = function (f) return f(f) end - return a(function (f) - return g(function (x) - local c=f(f) - return c(x) - end) - end) -end - - --- factorial without recursion -F = function (f) - return function (n) - if n == 0 then return 1 - else return n*f(n-1) end - end - end - -factorial = Y(F) -- factorial is the fixed point of F - --- now test it -function test(x) - io.write(x,"! = ",factorial(x),"\n") -end - -for n=0,16 do - test(n) -end |
