0
votes

I am new to Prolog and I had a question about defining predicates. I am reading some code where the same fact is defined more than once:

sister(jenny, sarah).
sister(jenny, sarah).
sister(jenny, sarah).

From what I understand, this is a fact representing that jenny and sarah are sisters but this code is repeated three times. What significance does this have?

1
It's redundant information. You've stated 3 times that jenny is sister of sarah. And if you query, sister(X, Y) you'll get the same answer 3 times.lurker

1 Answers

1
votes
sister(jenny, sarah).
sister(jenny, sarah).
sister(jenny, sarah).

What significance does this have?

None. It is a mistake.


With regards to

this is a function

Prolog does not have functions, only predicates.

With regards to

same predicate three times

Those are not predicates, those are facts because they have no :- or body.