op
Entity: predicate

Usage:
op(Priority, Type, Operator)

Operator definition.

Priority | Priority of the operator. Smaller numbers specify higher priority.
Type | Type of the operator.
Operator | Operator sign

Operator types:

fx, fy | prefix unary (the argument follows) e.g. minus X as -X
xf, yf | suffix unary (after the argument) e.g. factorial N as N!
xfx, yfy, xfy, yfx | infix binary (between the arguments) e.g. X+Y, X=Y

x and y letters specify associativity:

x the main operator in the operand must be of higher priority than this operator
y the main operator in the operand must be of higher or equal priority than this operator

Thus yfx denotes an operator which will be evaluated from left to right (such as - or / ), and xfy denotes an operator which will be evaluated from right to left (such as ; ), and xfx denotes an operator which is not associative (it can be placed only between arguments with the main operators of higher priority) such operators are > , < and yfy denotes an operator which is right and left associative (such as + or * ).

If you want to use an operator in the source then it should be defined as an axiom which is before the row where you want to use it or you can put the op operator in the body of a clause but in the second case this definition will take effect only after that this clause is executed.

The list of defined operators is available in Help/Operators. The operators are defined after compilation or after syntax colouring.

There are special types fxx, xxf, xfxx and xxfxx which can be used only for operators whose priority is lower than the priority of comma (i.e. with priority number bigger than 1000). Here xx shows that the operator expects a list of terms separated by commas instead of a single argument.

The operator :- is of type xfxx and that is why the expression H:-A, B will be read as ':-'(H, A, B) not as ':-'(H, [A, B] ) as if it was of type xfx. The expression H:-A will be read as ':-'(H, A) no matter whether the type of :- was xfxx or xfx.

The operator ?- is of type fxx and that is why the expression ?-A, B will be read as '?-'(A, B) not as '?-'( [A, B] ) as if it was of type fx. The expression ?-A will be read as '?-'(A) no matter whether the type of ?- was fxx or fx.

The operator ; is of type xxfyy and that is why the expression A; B will be read as ';'( [A], [B] ) not as ';'(A, B) as if it was of type yfx. The expression A, B; C, D will be read as ';'( [A, B], [C, D] ) no matter whether the type of ; was xxfyy or xfy.