about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorCase Duckworth2024-04-05 21:26:32 -0500
committerCase Duckworth2024-04-05 21:26:32 -0500
commitd9870a8616d095f46819ff6478d2ecc5d714fadc (patch)
tree15af45ab901f8b08c2a55942254b8cdb8c4a6ba6
parentAdd test file (diff)
downloadlam-d9870a8616d095f46819ff6478d2ecc5d714fadc.tar.gz
lam-d9870a8616d095f46819ff6478d2ecc5d714fadc.zip
Add dump and run into circular dependencies
-rw-r--r--core.lua13
-rw-r--r--repl.lua1
2 files changed, 13 insertions, 1 deletions
diff --git a/core.lua b/core.lua index f6d4e08..fd78997 100644 --- a/core.lua +++ b/core.lua
@@ -4,6 +4,8 @@ local m = {}
4local type = require "type" 4local type = require "type"
5local isa, null = type.isa, type.null 5local isa, null = type.isa, type.null
6local math = math 6local math = math
7local dump = require("dump").dump
8-- local load = require("repl").load -- circular dependency :<
7local util = require "util" 9local util = require "util"
8local assert_arity = util.assert_arity 10local assert_arity = util.assert_arity
9 11
@@ -43,6 +45,17 @@ m.env = { -- all functions here take R, which is the list of arguments
43 assert_arity(r, 0, 0) 45 assert_arity(r, 0, 0)
44 io.write("\n") 46 io.write("\n")
45 end, 47 end,
48 dump =
49 function (r)
50 assert_arity(r, 1, 1)
51 return dump(r[1])
52 end,
53 --[[ load = -- circular dependency :<
54 function (r)
55 assert_arity(r, 1, 1)
56 load(r[1])
57 end,
58 --]]
46 ------- numbers 59 ------- numbers
47 -- todo: assert all of these are numbers 60 -- todo: assert all of these are numbers
48 ["number?"] = 61 ["number?"] =
diff --git a/repl.lua b/repl.lua index 86bc0af..c4a6546 100644 --- a/repl.lua +++ b/repl.lua
@@ -41,7 +41,6 @@ function m.read_eval (filename, interactive)
41 io.write(lam) 41 io.write(lam)
42 io.output():setvbuf("line") 42 io.output():setvbuf("line")
43 else 43 else
44 io.output(io.stdout) -- hmmm
45 io.output():setvbuf("no") 44 io.output():setvbuf("no")
46 end 45 end
47 repeat 46 repeat