Webeks.net - freelance programming
freelance programming - php, Joomla, Zend ...
Home :: Articles :: Programming :: Prolog :: Prolog custom operators

Prolog custom operators

Written by Miha

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

 


blog comments powered by Disqus