[ Syntax Settings | Reference Manual | Alphabetic Index ]

current_op(-Precedence, -Associativity, -Name)

Succeeds if Name is a visible operator with precedence Precedence and associativity Associativity.
Precedence
Integer or variable.
Associativity
Atom or variable.
Name
Atom or variable.

Description

Used to check for the existence of a visible operator of precedence Precedence with name Name and associativity Associativity. Alternative solutions are returned on backtracking.

Precedence is an integer in the range 1 to 1200.

Associativity is one of the atoms

   xfx, xfy, yfx, fx, fy, xf, yf, fxx, fxy.

Modes and Determinism

Modules

This predicate is sensitive to its module context (tool predicate, see @/2).

Exceptions

(5) type error
Precedence is not an integer.
(5) type error
Associativity is not one of the above atoms.
(5) type error
Name is instantiated but not to an atom.
(6) out of range
Precedence is not in the range 0 to 1200.

Examples

Success:
   current_op(300, fx, *).

   [eclipse]: current_op(P, A, +).
   P = 500
   A = fx     More? (;)
   P = 500
   A = yfx     More? (;)   % RETURN pressed
   yes.

Fail:
   current_op(10, fx, noop).

Error:
   current_op(prec, fx, +).             (Error 5).
   current_op(100, fff, +).             (Error 5).
   current_op(100, fx, bad(op)).        (Error 5).
   current_op(-1, fx, +).               (Error 6).



See Also

op / 3