Search code examples
prologoperatorsclause

Can atom be both predicate and operator?


Is it possible to use atom as both operator and predicate. Something along the lines :

:- op(101, fy, rule).
:- op(99,  xfy, ==>).
rule(R) :- write_canonical(R).

So that I can say :

 rule ...blah... ==> ...abc..

instead of :

 rule( ...blah... ==> ...abc.).

Solution

  • As lurker said, the problem was resolved when I set correct precedence.

    In your specific case it will depend what else you have defined and how do you use it.

    To check for conflicting precedence use current_op/3.