Defining Operators in Prolog
You can see what Prolog will do with it with write_canonical/1
:
?- op(100,xfy,#).
true.
?- op(100,fy,@).
true.
?- write_canonical(a # @ b # c).
#(a,@(#(b,c)))
true.
So it seems that your first guesses are correct. The interpretation a # @ b # c
is equal a # (@(b # c))
. A key comment in the documentation forop/3
pertaining to this:
f
indicates the position of the functor, whilex
andy
indicate the position of the arguments.y
should be interpreted as "at this position there must be a term with a priority less than or equal to the priority of the functor." For thex
priority of the argument must be strictly lower.
Usage fy
results in grouping of priorities @(b # c)
instead of (@b) # c
.
source to share