refactoring

This commit is contained in:
Manuel Simon Hirsig
2016-07-31 15:14:55 +02:00
parent be200921ef
commit a0e0728298
6 changed files with 82 additions and 52 deletions
+9 -3
View File
@@ -3,8 +3,14 @@ local m, public, private = Aux.module'util'
function public.pass()
end
function public.id(object)
return object
function public.id(value)
return value
end
function public.const(value)
return function()
return value
end
end
function public.size(table)
@@ -147,7 +153,7 @@ end
function public.filter(xs, p)
local ys = {}
for _, x in ipairs(xs) do
for _, x in xs do
if p(x) then
tinsert(ys, x)
end