mirror of
https://github.com/appgurueu/modlib.git
synced 2024-11-22 07:13:45 +01:00
Add func.compose
This commit is contained in:
parent
cc63bf33ca
commit
b8560d7e62
10
func.lua
10
func.lua
@ -8,6 +8,10 @@ setfenv(1, _ENV)
|
||||
|
||||
no_op = function() end
|
||||
|
||||
-- TODO fix this being ugly AF
|
||||
|
||||
-- TODO switch all of these to vargs
|
||||
|
||||
function curry(func, ...)
|
||||
local args = { ... }
|
||||
return function(...) return func(unpack(args), ...) end
|
||||
@ -49,6 +53,12 @@ function memoize(func)
|
||||
})
|
||||
end
|
||||
|
||||
function compose(func, other_func)
|
||||
return function(...)
|
||||
return func(other_func(...))
|
||||
end
|
||||
end
|
||||
|
||||
function override_chain(func, override)
|
||||
return function(...)
|
||||
func(...)
|
||||
|
Loading…
Reference in New Issue
Block a user