diff options
| author | Bruce Hill <bitbucket@bruce-hill.com> | 2018-07-24 13:39:04 -0700 |
|---|---|---|
| committer | Bruce Hill <bitbucket@bruce-hill.com> | 2018-07-24 13:39:04 -0700 |
| commit | 723eb9e1f169fb2d1b19d53f48fe542edd7fc510 (patch) | |
| tree | 95cf9b53fb41bc850a264d3ee6240b545c438235 | |
| parent | ca653cbb84802d0eb644d54d957501100586bea8 (diff) | |
Added parens around lambdas (% -> %), and removed them from 'result %'
correspondingly.
| -rw-r--r-- | core/control_flow.nom | 2 | ||||
| -rw-r--r-- | core/metaprogramming.nom | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/core/control_flow.nom b/core/control_flow.nom index 1c3deaa..19a9186 100644 --- a/core/control_flow.nom +++ b/core/control_flow.nom @@ -484,7 +484,7 @@ test: assume ((result of (: return 99)) == 99) # Inline thunk: -compile [result of %body] to (Lua value "(\(compile as ([] -> %body)))()") +compile [result of %body] to (Lua value "\(compile as ([] -> %body))()") test: %t = [1, [2, [[3], 4], 5, [[[6]]]]] %flat = [] diff --git a/core/metaprogramming.nom b/core/metaprogramming.nom index 21743ad..8a4d450 100644 --- a/core/metaprogramming.nom +++ b/core/metaprogramming.nom @@ -6,14 +6,14 @@ lua> "NOMSU_CORE_VERSION = 5" lua> ".." nomsu.COMPILE_ACTIONS["% -> %"] = function(nomsu, tree, \%args, \%body) - local lua = LuaCode.Value(tree.source, "function(") + local lua = LuaCode.Value(tree.source, "(function(") if AST.is_syntax_tree(\%args, "Action") then \%args = \%args:get_args() end local lua_args = table.map(\%args, function(a) return AST.is_syntax_tree(a) and tostring(nomsu:compile(a)) or a end) lua:concat_append(lua_args, ", ") local body_lua = AST.is_syntax_tree(\%body) and nomsu:compile(\%body):as_statements("return ") or \%body body_lua:remove_free_vars(lua_args) body_lua:declare_locals() - lua:append(")\\n ", body_lua, "\\nend") + lua:append(")\\n ", body_lua, "\\nend)") return lua end |
