big refactoring

This commit is contained in:
Manuel Simon Hirsig
2016-08-22 15:58:43 +02:00
parent 4369e8ad12
commit 54c082cff9
5 changed files with 104 additions and 33 deletions
+2 -12
View File
@@ -33,9 +33,9 @@ end
do
local state
local function f()
local tmp = state
local temp = state
state = nil
return tmp
return temp
end
function public.present(v)
state = v; return f
@@ -201,16 +201,6 @@ function public.map(xs, f)
return ys
end
do
local mt = {__call = function(self, key) return self[key] end}
function public.set(t)
local self = {}
for i=1,getn(t) do self[t[i]] = true end
recycle(t)
return setmetatable(self, mt)
end
end
function public.trim(str)
return gsub(str, '^%s*(.-)%s*$', '%1')
end