lua-users home
lua-l archive

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


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,...)