lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


> This would be cool:
> 
> v = f(x) <- g(y) <- h(z)
> v = v() -- v = result of f(x, g(y, h(z)))

Without the currying, one can this in Lua:

--  Mathematica style

debug.setmetatable(function () end,
	{ __idiv = function (a,b) return b(a) end})

_ = 2 // math.sqrt // print

-- Unix pipe style

debug.setmetatable(function () end,
	{ __bor = function (a,b) return b(a) end})

_ = 2 | math.sqrt | print