--- lam.repl local repl = {} local eval = require "eval" local read = require "read" local util = require "util" function schemestr(x) if type(x) == "table" then local ts = "(" .. schemestr(util.pop(x)) for i,v in ipairs(x) do ts = string.format("%s %s", ts, schemestr(v)) end ts = ts .. ")" return ts elseif x == true then return "#t" elseif x == false then return "#f" else return tostring(x) end end function repl.repl (prompt) prompt = prompt or "lam> " repeat io.write(prompt) io.output():flush() input = io.read() if input == ",q" or input == ",quit" then break else val = eval(read(input)) if val then print(schemestr(val)) end end until false end --- return repl