diff options
author | elioat <elioat@tilde.institute> | 2024-06-09 19:00:52 -0400 |
---|---|---|
committer | elioat <elioat@tilde.institute> | 2024-06-09 19:00:52 -0400 |
commit | 214332fa4e7dce2b4a44884cd2f201bdbbc65eef (patch) | |
tree | e2a7c2ba9eac71ac449d87b368e807c183c29232 /lua/chupacabra | |
parent | 48f7b2508802e031e883ecbdb802d19c807af0e2 (diff) | |
download | tour-214332fa4e7dce2b4a44884cd2f201bdbbc65eef.tar.gz |
*
Diffstat (limited to 'lua/chupacabra')
-rw-r--r-- | lua/chupacabra/scratch.lua | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/lua/chupacabra/scratch.lua b/lua/chupacabra/scratch.lua index 204d383..4172950 100644 --- a/lua/chupacabra/scratch.lua +++ b/lua/chupacabra/scratch.lua @@ -12,11 +12,23 @@ local function table_to_string(t) return str end +local stack = {} + local function scratch(input) local output = chupacabra.run(input, {}) - print("Input: " .. input) - print("Output: " .. table_to_string(output)) + table.insert(stack, {input = input, output = output}) end +local function print_stack() + for i, entry in ipairs(stack) do + print(i .. " input: " .. entry.input) + print(" output: " .. table_to_string(entry.output)) + end +end + +scratch("3 : + [1 1 1] [2 3 4] @+ @..") +scratch("[2 4 6] 2 @..") scratch("3 : + [1 1 1] [2 3 4] @+ @..") -scratch("[2 4 6] 2 @..") \ No newline at end of file +scratch("[2 4 6] 2 @..") +scratch("1 2 3 4 5 6 7 @.. [1 2 3 0 5 6 7] @=") +print_stack() |