From 692fae5416ce1f2702b599ffb27b2e3d2235eba7 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Wed, 26 Sep 2018 12:45:08 -0700 Subject: Incremental fixes and more nomnom ports. --- core/math.nom | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'core/math.nom') diff --git a/core/math.nom b/core/math.nom index d6ddbce..5daa2d8 100644 --- a/core/math.nom +++ b/core/math.nom @@ -89,6 +89,32 @@ compile [sum of %items, sum %items] to: %clauses = ((% as lua expr) for % in %items) return (Lua value "(\(%clauses::joined with " + "))") +parse [if all of %items %body, if all of %items then %body] as (..) + if (all of %items) %body +parse [unless all of %items %body, unless all of %items then %body] as (..) + if (not (all of %items)) %body +parse [if any of %items %body, if any of %items then %body] as (..) + if (any of %items) %body +parse [unless any of %items %body, unless any of %items then %body] as (..) + if (not (any of %items)) %body +parse [if none of %items %body, if none of %items then %body] as (..) + if (not (any of %items)) %body +parse [unless none of %items %body, unless none of %items then %body] as (..) + if (any of %items) %body + +parse [if all of %items %body else %else, if all of %items then %body else %else] as (..) + if (all of %items) %body else %else +parse [unless all of %items %body else %else, unless all of %items then %body else %else] as (..) + if (not (all of %items)) %body else %else +parse [if any of %items %body else %else, if any of %items then %body else %else] as (..) + if (any of %items) %body else %else +parse [unless any of %items %body else %else, unless any of %items then %body else %else] as (..) + if (not (any of %items)) %body else %else +parse [if none of %items %body else %else, if none of %items then %body else %else] as (..) + if (not (any of %items)) %body else %else +parse [unless none of %items %body else %else, unless none of %items then %body else %else] as (..) + if (any of %items) %body else %else + compile [product of %items, product %items] to: unless (%items.type is "List"): return (Lua value "utils.product(\(%items as lua expr))") -- cgit v1.2.3