[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Operators on functions
- From: Dirk Laurie <dirk.laurie@...>
- Date: Mon, 18 Nov 2013 20:20:35 +0200
With the aid of debug.setmetatable it is possible to define
expressions involving functions. What would be a sensible
mapping of operators to metamethods? For example:
Composition: __pow -- (f^g)(...) <--> f(g(...))
Cartesian product: __mul -- (f*g)(...) <--> {f(...),g(...)}
Multiple return: __concat -- (f..g)(...) <--> f(...),g(...) (right associative)
Binding: __div -- (f/s)(x) <--> f(x,s), (s/f)(...) <--> f(s,...)