How to stop repetitions in rules in prolog

Posted by Pradeep on Stack Overflow See other posts from Stack Overflow or by Pradeep
Published on 2010-03-17T05:10:26Z Indexed on 2010/03/17 5:21 UTC
Read the original article Hit count: 164

Filed under:

In my prolog rule

marriedcouple(X,Y) :-
 parent((X,Z),bornin(_)),
 parent((Y,Z),bornin(_)),
 female(X),male(Y);
 male(X),female(Y),
 different(X,Y).

when a parent has two kids, the couple shows twice. How can we prevent this ?

© Stack Overflow or respective owner

Related posts about prolog