1

example:

PREDICATES
nondeterm likes (symbol,symbol)

CLAUSES
likes (ali,football).
likes (ali,tenis).
likes (ahmad,tenis).
likes (ahmad,handball).
likes (samir,handball).
likes (samir,swimming).
likes (khaled,horseriding).

GOAL
%
likes (Person, G1), likes (Person,G2), G1<>G2.
false
  • 10,264
  • 13
  • 101
  • 209
StreamsGit
  • 91
  • 1
  • 7
  • Maybe this helps: [Prolog - Operator in predicate](https://stackoverflow.com/questions/37534509/prolog-operator-in-predicate) – mattja Feb 08 '21 at 08:21

1 Answers1

3

In that example, <> means "is not equal". The query:

likes(Person, G1),
likes(Person, G2),
G1 <> G2.

Is meant to find a Person that likes two things. Without the <>, G1 and G2 could be equal to each other and the query could find a Person that likes only one thing.

<> may be specific to Visual Prolog. In other Prolog environments you would use \= or \== instead.

Etienne Laurin
  • 6,731
  • 2
  • 27
  • 31