about summary refs log tree commit diff stats
path: root/lua
diff options
context:
space:
mode:
authorelioat <elioat@tilde.institute>2024-06-09 19:00:52 -0400
committerelioat <elioat@tilde.institute>2024-06-09 19:00:52 -0400
commit214332fa4e7dce2b4a44884cd2f201bdbbc65eef (patch)
treee2a7c2ba9eac71ac449d87b368e807c183c29232 /lua
parent48f7b2508802e031e883ecbdb802d19c807af0e2 (diff)
downloadtour-214332fa4e7dce2b4a44884cd2f201bdbbc65eef.tar.gz
*
Diffstat (limited to 'lua')
-rw-r--r--lua/chupacabra/scratch.lua18
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()