Next: mpg-ref-open, Previous: mpg-ref-once, Up: mpg-bpr [Contents][Index]
op/3
ISOop(+Precedence, +Type, +Name)
declares Name to be an operator of the stated Type and Precedence.
integer, must be nonvar and in the range 1-1200
one of [xfx,xfy,yfx,fx,fy,xf,yf]
, must be nonvar
atom or list of atom, must be ground
Operators are a notational convenience
to read and write Prolog terms. You can define new operators using
op/3
.
The Precedence of an operator is used to disambiguate the way terms are parsed. The general rule is that the operator with the highest precedence is the principal functor.
The Type of an operator decides the position of an operator and its associativity. In the atom that represents the type the character ‘f’ represents the position of the operator. For example, a type ‘fx’ says that the operator is a prefix operator. The character ‘y’ indicates that the operator is associative in that direction. For example, an operator of type ‘xfy’ is a right-associative, infix operator.
To cancel the operator properties of Name (if any) set Precedence to 0.
Please note: operators are global, as opposed to being local to the current module, Prolog text, or otherwise.
instantiation_error
An argument is not ground
type_error
Precedence is not an integer or Type is not an integer or an operator is not an atom
domain_error
Precedence is not in the range 1-1200, or Type is invalid,
permission_error
Attempt to redefine the operator ','
current_op/3
, ref-syn-ops.