OperatorHandlers HANDLERΒΆ

fmt.spad line 322 [edit on github]

OperatorHandlers is an auxiliary domain. It is used holds functions for each operator of OutputForm, classified by the arity and the name of that operator.

handler: (%, Integer, String) -> HANDLER

handler(x, n, op) is only valid if knownHandler?(n, op) is true. It returns the respective handler stored in x.

knownHandler?: (%, Integer, String) -> Boolean

knownHandler?(x, n, op) checks whether a handler for operator op is known. The number n denotes the number of arguments that the operator can take. It is OK if both knownOperator?(m, op) and knownOperator?(n, op) return true for different m and n.

new: () -> %

new() creates an empty structure of handlers.

removeHandler!: (%, Integer, String) -> Void

removeHandler!(n, op) removes any handler from an internal data structure (for the pair (n, op) such that afterwards knownHandler?(x, n, op) returns false.

setHandler!: (%, Integer, String, HANDLER) -> HANDLER

setHandler!(x, n, op, hdl) puts hdl into the data structure x such that it can be queried afterwards.