From d72e589a6226dd234050e9ac710501aa05d35d14 Mon Sep 17 00:00:00 2001 From: Lars Mueller Date: Fri, 30 Sep 2022 16:09:16 +0200 Subject: [PATCH] Add func.identity --- func.lua | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/func.lua b/func.lua index a559699..cb01e0b 100644 --- a/func.lua +++ b/func.lua @@ -6,11 +6,11 @@ local modlib, unpack, select, setmetatable local _ENV = {} setfenv(1, _ENV) -no_op = function() end +function no_op() end --- TODO fix this being ugly AF +function identity(...) return ... end --- TODO switch all of these to vargs +-- TODO switch all of these to proper vargs function curry(func, ...) local args = { ... } @@ -73,6 +73,8 @@ end -- Functional wrappers for Lua's builtin metatable operators (arithmetic, concatenation, length, comparison, indexing, call) +-- TODO (?) add operator table `["+"] = add, ...` + function add(a, b) return a + b end function sub(a, b) return a - b end