From 4126589afef1c3c14cfa5a3a0f43cc6e98569f1d Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Thu, 10 May 2018 22:47:03 -0700 Subject: Cleanup: removed "File" type trees (now just Block), overhauled how_do_i.nom, added "result of %" macro, which allowed comprehensions to be way more concisely defined. Moved len() operator into the nomsu environment. --- core/operators.nom | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'core/operators.nom') diff --git a/core/operators.nom b/core/operators.nom index 706909c..56e89cb 100644 --- a/core/operators.nom +++ b/core/operators.nom @@ -163,14 +163,8 @@ immediately # Unary operators compile [- %] to: Lua value "(- \(% as lua expr))" compile [not %] to: Lua value "(not \(% as lua expr))" - compile [length of %list] to - # A bit of a hack so that luajit works properly. - Lua value ".." - (function(l) - local mt = getmetatable(l); - if mt and mt.__len then return mt.__len(l) end - return #l - end)(\(%list as lua expr)) + # Using custom "len()" instead of Lua's "#" operator for compatibility with luajit. + compile [length of %list] to: Lua value "len(\(%list as lua expr))" # Update operators immediately -- cgit v1.2.3