Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Sage already has an infix_operator decorator:

sage: @infix_operator('or')
....: def f(x,y): return x.add(y, hold=True)
....: 
sage: x |f| x |f| x
(x + x) + x

See http://sagemath.org/doc/reference/sage/misc/decorators.html?highlight=infix_operator#sage.misc.decorators.infix_operator