op/3
[ISO]op(
+Precedence,
+Type,
+Name)
declares Name to be an operator of the stated Type and Precedence.
[xfx,xfy,yfx,fx,fy,xf,yf]
, must be nonvar
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.
instantiation_error
type_error
domain_error
permission_error
','
current_op/3
, ref-syn-ops.