How to represent "Alberich hates everyone but himself" in Prolog?

Viewed 52

I'm currently learning prolog and I'm trying to get the syntax right for "Alberich hates everyone but himself". I suppose I could represent "Alberich hates everyone" as hates(Alberich, X) but how do I represent "but himself" ?

1 Answers

You specify that X is different from albrich:

hates(alberich, X) :-
    dif(alberich, X).

Note that constants start with a lowercase, so you should use alberich, not Alberich, since Alberich is just a variable that has as identifier Alberich.

Related