Re: where do I think wrong
Kilian Evang <[email protected]>
| Newsgroups | gmane.comp.ai.prolog.swi |
|---|---|
| Message-ID | <[email protected]> |
On 14-03-14 13:26, Roelof Wobben wrote: >> Date: Fri, 14 Mar 2014 12:03:03 +0100 >> > From: [email protected] >> > To: [email protected] >> > Subject: Re: [SWIPL] where do I think wrong >> > >> > On 14-03-14 07:54, Roelof Wobben wrote: >>>> > >> half_or_full_siblings(X, Y) :- >>>>> > >> > ( same_father(X, Y), >>>>> > >> > X \== Y >>>>> > >> > ; same_mother(X, Y), >>>>> > >> > \+ same_father(X, Y) >>>>> > >> > ). >>> > > >>> > > Oke, I think this is what im searching for. >>> > > One rule for full and half siblings. >>> > > >>> > > But I do not understand why "is not equal" is used. >> > >> > Because you don't usually want to say that a person is his or her own >> > sibling. > No, that was is this one: X /== Y. > > Im talking about this one : > ; same_mother(X, Y), <- have the same mother and > \+ same_father(X, Y) <- is not equal to the same father. > ). > > What if father is divorced and marry another female. > Then the father is the same but the mother not. That's what the first branch of the "or" is for, there you check for same_father(X, Y). In the second branch same_father(X, Y) is negated just so you don't get the same solution twice, as Richard explained.