diff options
author | Anthony Wang | 2021-12-08 12:40:12 -0600 |
---|---|---|
committer | Anthony Wang | 2021-12-08 12:40:12 -0600 |
commit | f6c080fd9f22141085046b3ead643563648a1276 (patch) | |
tree | c49ae2f7c72eab2d0f1a03134b895d32b641a7f5 | |
parent | 9e38c72d03320a935200427602f8220c4008eef7 (diff) |
Add Lua code
-rwxr-xr-x | run.sh | 2 | ||||
-rw-r--r-- | test.lua | 25 |
2 files changed, 26 insertions, 1 deletions
@@ -59,4 +59,4 @@ echo Lisp hyperfine "ecl --shell test.lisp" echo Lua - +hyperfine "lua test.lua" diff --git a/test.lua b/test.lua new file mode 100644 index 0000000..3d26a40 --- /dev/null +++ b/test.lua @@ -0,0 +1,25 @@ +-- Lua + +function gcd(a, b) + if b > 0 then + return gcd(b, a % b); + else + return a; + end +end + +print("test"); + +N = 1000; +A = {}; +for i = 1, N do + A[i] = i - 1; +end + +ans = 0; +for _, i in ipairs(A) do + for _, j in ipairs(A) do + ans = gcd(i, j) + ans; + end +end +print(ans); |