BAP Online Manuals : Library Reference : Library by Name : op
Previous: not
Next: openmodify

6.2.91. op

defines an operator

SYNOPSIS

op(300,xfy,'^')

SYNTAX

op(Precedence,Associativity,Operator) (i,i,i) , (x,x,x)

ARGUMENTS

integer(Precedence) (x) precedence of the operator.
atom(Associativity) (x) associativity of the operator
atom(Operator) (x) Operator to be declared

DESCRIPTION

This is a standard prolog built-in. If all three arguments are bound, Operator is declared as operator having the Associativity and Precedence indicated. Otherwise the input terms will be matched with the existing operators.
NOTE: This operator declaration only affects runtime behaviour. To declare operators within your modules you must use the OPERATOR keyword.
The following operators are predefined:

 op(1200,xfx, :- ). 	op(1100,xfy, ; ).  	op(1000,xfy, , ).
 op(900,fy, not ).  	op(900,fx, deter ).  	op(700,xfx, = ).
 op(700,xfx, \= ).  	op(700,xfx, is ).  	op(700,xfx, < ).
 op(700,xfx, =< ).  	op(700,xfx, > ).  	op(700,xfx, >= ).
 op(700,xfx, == ).  	op(700,xfx, \== ).  	op(700,xfx, =.. ).
 op(600,xfx, -> ).  	op(600,xfx, <-> ).  	op(500,yfx, + ).
 op(500,fx, + ).     	op(500,yfx, - ).   	op(500,fx, - ).
 op(400,yfx, * ).    	op(400,yfx, / ).    	op(300,xfx, mod ).

EXAMPLE

op(300,xfy,'^'),
write( '^'(x,2)).

ERRORS

A runtime error occurs if an illegal associativity is given.

RELATED PREDICATES

read , write , consult , listing


BAP Online Manuals : Library Reference : Library by Name : op
Previous: not
Next: openmodify