2d3c680

Faddle · faddle.git · Tickets

Branches > main > 2d3c680 > files

Fix () in compilation

Grahp, 2026-07-18

Commit: 2d3c6807e7f99881203c671aef1bb383530701f8
Parent: af3fc57

2 changed files:

org/faddle/lang/compile.lua modified (view file)

@@ -67,7 +67,7 @@ compile = function(form, statement)   if is_list(form) then     -- if count(form) == 0 then return "__rt.list()" end-    if count(form) == 0 then return ret(statement) .. "require('org.faddle').list()" end+    if count(form) == 0 then return ret(statement) .. "require('org.faddle.lang.rt').list()" end     -- If it's a literal number or string you can compile directly to a lookup     -- Symbols still need to be checked whether they resolve to a string or number though     if first(form) == FN then return compile_fn(form, statement) end

test.lua modified (view file)

@@ -148,12 +148,22 @@ -- local compile = compiler.compile  teq(read_eval("(let [x 42] 42)"), 42)+teq(read_eval("(let [x 42] x)"), 42) teq(read_eval("((fn [] 42))"), 42) teq(read_eval("(let [f (fn [] 42)] (f))"), 42) +teq(read_eval("(let [x ()] x)"), list())+ -- Later -- teq(read_eval("(let [x 1 y 2] [x y])"), {1, 2}) -- teq(read_eval("((fn [x] x) :abc)"), :abc)+-- teq(read_eval("((fn []))"), nil)+-- teq(read_eval("((let []))"), nil)++-- Feels like do could be implemented in terms of let or fn idk.+-- teq(read_eval("(do)"), nil)+-- teq(read_eval("(do 1)"), 1)+-- teq(read_eval("(do 1 2 3)"), 3)  ---