From dcd3391b36c7accc194cfdc8654db085c9bc820e Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Mon, 2 Oct 2017 17:21:22 -0700 Subject: Updated to undo some of the block/thunk stuff. Thunks are thunks, and expressions can be grouped with parens, and they have a clear distinction. --- lib/plurals.nom | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'lib/plurals.nom') diff --git a/lib/plurals.nom b/lib/plurals.nom index d0cbcf0..347c2e7 100644 --- a/lib/plurals.nom +++ b/lib/plurals.nom @@ -4,32 +4,32 @@ require "lib/secrets.nom" # Plurals with secrets: lua block ".." - |local endings = setmetatable({x="es",c="es",s="es"}, {__index=function() return "s" end}) + |local endings = setmetatable({x="es",c="es",s="es"}, {__index=function() return "s"; end}); |secrets.plurals = setmetatable({}, {__index=function(self,key) - | return key..endings[key:sub(-1)] - |end}) + | return key..endings[key:sub(-1)]; + |end}); |secrets.singulars = setmetatable({}, {__index=function(self,key) - | if key:sub(-2) == "es" and rawget(endings, key:sub(-3,-3)) then return key:sub(1,-3) end - | if key:sub(-1) == "s" then return key:sub(1,-2) end - | return key - |end}) + | if key:sub(-2) == "es" and rawget(endings, key:sub(-3,-3)) then; return key:sub(1,-3); end; + | if key:sub(-1) == "s" then; return key:sub(1,-2); end; + | return key; + |end}); |secrets.canonicals = setmetatable({}, {__index=function(self,key) - | if key:sub(-1) == "s" then return secrets.singulars[key] end - | return key - |end}) + | if key:sub(-1) == "s" then; return secrets.singulars[key]; end; + | return key; + |end}); - rule (the plural of %singular is %plural) =: - (secret %plurals)->%singular =: %plural - (secret %singulars)->%plural =: %singular - (secret %canonicals)->%plural =: %singular + rule [the plural of %singular is %plural] =: + (secret %plurals)->%singular = %plural + (secret %singulars)->%plural = %singular + (secret %canonicals)->%plural = %singular - rule (singular %plural) =: + rule [singular %plural] =: %plural in (secret %singulars) - rule (plural %singular) =: + rule [plural %singular] =: %singular in (secret %plurals) - rule (canonicalize %item-name) =: + rule [canonicalize %item-name] =: %item-name in (secret %canonicals) - rule (rules that change plurals) =: ["the plural of % is %"] + rule [rules that change plurals] =: ["the plural of % is %"] -- cgit v1.2.3