happy(fred). likes(mary, pizza).
as opposed to this rule:
happy(Person) :- healthy(Person), enough_money(Person), has_friends(Person).
Bodiless clauses with variables, like …
member(Item, [Item | RestOfList]).
… behave like rules in that they provide a general
way of knowing that, for any
item is a member of a list of which it is
the first item (see also member).
The clause above is likely to generate a SWI Prolog warning
message like this:
Singleton variables: [RestOfList]to tell you that the variable
RestOfListis only mentioned once in the code (so may be a spelling mistake, for example). You can suppress the warning by writing, instead:
member(Item, [Item | _]).using a don't-care variable, although this may be more difficult for a human to follow, particularly a beginnner at Prolog.