Prolog custom operators
Operator definitions in Prolog look like this:
:- op(Precedence, Type, Name).
%Precedence is a number between 0 and 1200.
%Type is an atom specifying type and associativity of operator
There are the following possibilities for what Type may look like:
- infix xfx, xfy, yfx
- prefix fx, fy
- suffix xf, yf
x stands for an argument with lower precedence than operator f
y stands for an argument with lower or equal precedence than operator f
Related Articles
| < Prev |
|---|