INEQUALITY Expressions Definitions for Expressions
- It is possible to add new operators to MACSYMA (infix, prefix, postfix, unary, or matchfix with given precedences), to remove existing operators, or to redefine the precedence of existing operators. While MACSYMA's syntax should be adequate for most ordinary applications, it is possible to define new operators or eliminate predefined ones that get in the user's way. The extension mechanism is rather straightforward and should be evident from the examples below.
(C1) PREFIX("DDX")$ (C2) DDX Y$ means "DDX"(Y) (C3) INFIX("<-")$ (C4) A<-DDX Y$ means "<-"(A,"DDX"(Y))
For each of the types of operator except SPECIAL, there is a corresponding creation function that will give the lexeme specified the corresponding parsing properties. Thus "PREFIX("DDX")" will make "DDX" a prefix operator just like "-" or "NOT". Of course, certain extension functions require additional information such as the matching keyword for a matchfix operator. In addition, binding powers and parts of speech must be specified for all keywords defined. This is done by passing additional arguments to the extension functions. If a user does not specify these additional parameters, MACSYMA will assign default values. The six extension functions with binding powers and parts of speech defaults (enclosed in brackets) are summarized below. PREFIX(operator, rbp, rpos[ANY], pos[ANY]) POSTFIX(operator, lbp, lpos[ANY], pos[ANY]) INFIX(operator, lbp, rbp, lpos[ANY], rpos[ANY],pos[ANY]) NARY(operator, bp, argpos[ANY], pos[ANY]) NOFIX(operator, pos[ANY]) MATCHFIX(operator, match, argpos[ANY], pos[ANY]) The defaults have been provided so that a user who does not wish to concern himself with parts of speech or binding powers may simply omit those arguments to the extension functions. Thus the following are all equivalent. PREFIX("DDX",180,ANY,ANY)$ PREFIX("DDX",180)$ PREFIX("DDX")$ It is also possible to remove the syntax properties of an operator by using the functions REMOVE or KILL. Specifically, "REMOVE("DDX",OP)" or "KILL("DDX")" will return "DDX" to operand status; but in the second case all the other properties of "DDX" will also be removed.INEQUALITY Expressions Definitions for Expressions