op.spad line 1 [edit on github]
A basic operator is an object that can be applied to a list of arguments from a set, the result being a kernel over that set.
arity(op)
returns n
if op
is n
-ary, and "failed" if op
has arbitrary arity.
assert(op, s)
attaches property s
to op
. Argument op
is modified "in place", i.e. no copy is made.
comparison(op, foo?)
attaches foo? as the "%less?" property to op
. If op1
and op2
have the same name, and one of them has a "%less?" property f
, then f(op1, op2)
is called to decide whether op1 < op2
.
copy(op)
returns a copy of op
.
deleteProperty!(op, s)
unattaches property s
from op
. Argument op
is modified "in place", i.e. no copy is made.
display(op, foo)
attaches foo as the "%display" property of op
. If op
has a "%display" property f
, then op(a1,...,an)
gets converted to OutputForm as f(a1, ..., an)
.
display(op, foo)
attaches foo as the "%display" property of op
. If op
has a "%display" property f
, then op(a)
gets converted to OutputForm as f(a)
. Argument op
must be unary.
display(op)
returns the "%display" property of op
if it has one attached, and "failed" otherwise.
equality(op, foo?)
attaches foo? as the "%equal?" property to op
. If op1
and op2
have the same name, and one of them has an "%equal?" property f
, then f(op1, op2)
is called to decide whether op1
and op2
should be considered equal.
has?(op, s)
tests if property s
is attached to op
.
input(op, foo)
attaches foo as the "%input" property of op
. If op
has a "%input" property f
, then op(a1,...,an)
gets converted to InputForm as f(a1, ..., an)
.
input(op)
returns the "%input" property of op
if it has one attached, "failed" otherwise.
is?(op, s)
tests if the name of op
is s
.
name(op)
returns the name of op
.
nary?(op)
tests if op
has arbitrary arity.
nullary?(op)
tests if op
is nullary.
operator(f)
makes f
into an operator with arbitrary arity.
operator(f, n)
makes f
into an n
-ary operator.
properties(op)
returns the list of all the properties currently attached to op
.
property(op, s)
returns the value of property s
if it is attached to op
, and "failed" otherwise.
setProperties(op, l)
sets the property list of op
to l
. Argument op
is modified "in place", i.e. no copy is made.
setProperty(op, s, v)
attaches property s
to op
, and sets its value to v
. Argument op
is modified "in place", i.e. no copy is made.
unary?(op)
tests if op
is unary.
weight(op, n)
attaches the weight n
to op
.
weight(op)
returns the weight attached to op
.