blob: 9fe504dcda78615edffe16b57b0d44b5cdaf1aae (
plain) (
tree)
|
|
local chupacabra = require("chupacabra")
local stack = {}
local function scratch(input)
local output = chupacabra.run(input, {})
table.insert(stack, {input = input, output = output})
end
local function scratch_out()
for i, entry in ipairs(stack) do
print(i .. " input: " .. entry.input)
if type(entry.output) == "table" then
print(" output: " .. chupacabra.table_to_string(entry.output))
else
print(" output: " .. tostring(entry.output))
end
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 @..")
scratch("1 2 3 4 5 6 7 @.. [1 2 3 0 5 6 7] @=")
scratch("2 3 +")
scratch("3 : + 6 =")
scratch_out()
|