Last active
September 20, 2019 03:07
-
-
Save mathias/7f221a2174ac0cef1cc956882d4aab39 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(local tbl {:foo (fn [] "bar")}) | |
(fn qux [f] | |
(each [e f] | |
(print e))) ; where my code has the bug | |
(fn baz [] | |
(if tbl.foo | |
(let [result (tbl.foo)] | |
(print result) | |
(qux tbl)))) | |
(baz) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local function _0_() | |
return "bar" | |
end | |
local tbl = {foo = _0_} | |
local function qux(f) | |
for e in f do | |
print(e) | |
end | |
return nil | |
end | |
local function baz() | |
if tbl.foo then | |
local result = tbl.foo() | |
print(result) | |
return qux(tbl) | |
end | |
end | |
return baz() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment