BasicOperator¶
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.
- <=: (%, %) -> Boolean
from PartialOrder
- <: (%, %) -> Boolean
from PartialOrder
- >=: (%, %) -> Boolean
from PartialOrder
- >: (%, %) -> Boolean
from PartialOrder
- arity: % -> Union(NonNegativeInteger, failed)
arity(op)
returnsn
ifop
isn
-ary, and “failed” ifop
has arbitrary arity.
- assert: (%, Symbol) -> %
assert(op, s)
attaches propertys
toop
. Argumentop
is modified “in place”, i.e. no copy is made.
- coerce: % -> OutputForm
from CoercibleTo OutputForm
- comparison: (%, (%, %) -> Boolean) -> %
comparison(op, foo?)
attaches foo? as the “%less?” property toop
. Ifop1
andop2
have the same name, and one of them has a “%less?” propertyf
, thenf(op1, op2)
is called to decide whetherop1 < op2
.
- copy: % -> %
copy(op)
returns a copy ofop
.
- deleteProperty!: (%, Symbol) -> %
deleteProperty!(op, s)
unattaches propertys
fromop
. Argumentop
is modified “in place”, i.e. no copy is made.
- display: % -> Union(List OutputForm -> OutputForm, failed)
display(op)
returns the “%display” property ofop
if it has one attached, and “failed” otherwise.
- display: (%, List OutputForm -> OutputForm) -> %
display(op, foo)
attaches foo as the “%display” property ofop
. Ifop
has a “%display” propertyf
, thenop(a1,...,an)
gets converted to OutputForm asf(a1, ..., an)
.
- display: (%, OutputForm -> OutputForm) -> %
display(op, foo)
attaches foo as the “%display” property ofop
. Ifop
has a “%display” propertyf
, thenop(a)
gets converted to OutputForm asf(a)
. Argumentop
must be unary.
- equality: (%, (%, %) -> Boolean) -> %
equality(op, foo?)
attaches foo? as the “%equal?” property toop
. Ifop1
andop2
have the same name, and one of them has an “%equal?” propertyf
, thenf(op1, op2)
is called to decide whetherop1
andop2
should be considered equal.
- input: % -> Union(List InputForm -> InputForm, failed)
input(op)
returns the “%input” property ofop
if it has one attached, “failed” otherwise.
- input: (%, List InputForm -> InputForm) -> %
input(op, foo)
attaches foo as the “%input” property ofop
. Ifop
has a “%input” propertyf
, thenop(a1,...,an)
gets converted to InputForm asf(a1, ..., an)
.
- latex: % -> String
from SetCategory
- max: (%, %) -> %
from OrderedSet
- min: (%, %) -> %
from OrderedSet
- name: % -> Symbol
name(op)
returns the name ofop
.
- nary?: % -> Boolean
nary?(op)
tests ifop
has arbitrary arity.
- nullary?: % -> Boolean
nullary?(op)
tests ifop
is nullary.
- operator: (Symbol, NonNegativeInteger) -> %
operator(f, n)
makesf
into ann
-ary operator.
- operator: Symbol -> %
operator(f)
makesf
into an operator with arbitrary arity.
- properties: % -> AssociationList(Symbol, None)
properties(op)
returns the list of all the properties currently attached toop
.
- property: (%, Symbol) -> Union(None, failed)
property(op, s)
returns the value of propertys
if it is attached toop
, and “failed” otherwise.
- setProperties: (%, AssociationList(Symbol, None)) -> %
setProperties(op, l)
sets the property list ofop
tol
. Argumentop
is modified “in place”, i.e. no copy is made.
- setProperty: (%, Symbol, None) -> %
setProperty(op, s, v)
attaches propertys
toop
, and sets its value tov
. Argumentop
is modified “in place”, i.e. no copy is made.
- smaller?: (%, %) -> Boolean
from Comparable
- unary?: % -> Boolean
unary?(op)
tests ifop
is unary.
- weight: % -> NonNegativeInteger
weight(op)
returns the weight attached toop
.
- weight: (%, NonNegativeInteger) -> %
weight(op, n)
attaches the weightn
toop
.