I am recently learning about Prolog and I find the three types used for defining infix operators confusing.
What are the differences between xfx, xfy and yfx when specifying the type of an operator? I have googled about the problem and haven't found anything useful.
I tried typing the following codes in Prolog:
:- op(500,yfx,is_alive).
is_alive(A,B) :- display([A,B]).
:- op(500,xfy,is_alive2).
is_alive2(A,B) :- display([A,B]).
:- op(500,xfx,is_alive3).
is_alive3(A,B) :- display([A,B]).
and the output:
| ?- 1 is_alive 2.
'.'(1,'.'(2,[]))
yes
| ?- 1 is_alive2 2.
'.'(1,'.'(2,[]))
yes
| ?- 1 is_alive3 2.
'.'(1,'.'(2,[]))
yes
The results showed no difference to me.