by oedo · 3y ago · 0 comments
This Fennel:
(fn foo [x y ...]
(print x y ...))
(lambda bar [x ?y ...]
(print x ?y ...))
...transpiles to this Lua: local function foo(x, y, ...)
return print(x, y, ...)
end
local function bar(x, _3fy, ...)
_G.assert((nil ~= x), "Missing argument x on test.fnl:3")
return print(x, _3fy, ...)
end
[1] Fennel's alternative `& xs` vargs format does create a runtime check in functions declared with lambda, but it always evaluates to true because it simply nil-checks the table (here `xs`) that it dumps Lua `...` vargs into.No comments yet.