I've seen a few questions on this topic, however none of them really answers my question properly. I'll write a small example, here are some facts:
football(john).
football(sam).
tennis(john).
tennis(pete).
netball(sandy).
I want to create a rule that states pete
likes anyone that plays football or tennis.
likes(pete, X) :- (football(X) ; tennis(X)), X \= pete.
But obviously when I query it in Prolog, john
will come up twice as john
plays both football and tennis. I want it to come up with john
only once. How can I amend my code to do that?
Thanks in advance - Dan