Re: Siblings of parents

Feliks Kluzniak <[email protected]>
Newsgroups gmane.comp.ai.prolog.swi
Message-ID <[email protected]>
Well, read the error message.

The clauses for is_mother/2 and is_father/2 should end with periods (dots), not commas.

— F.


On Mar 8, 2014, at 18:21, Roelof Wobben <[email protected]> wrote:

> Thanks, 
> 
> 
> I changed it to this:
> 
> 
> male(roelof). 
> 
> male(mans).
> 
> male(jan).
> 
> 
> female(chantal). 
> 
> female(tamara). 
> 
> female(marie). 
> 
> 
> parent(roelof,tamara).
> 
> parent(mans, roelof). 
> 
> parent(jan, chantal). 
> 
> parent(marie, roelof). 
> 
> parent(chantal, tamara). 
> 
> 
> is_mother(Child,Mother):- 
> 
> parent(Mother, Child),
> 
> female(Mother),
> 
> 
> 
> is_father(Child, Father):- 
> 
> parent(Father, Child),
> 
> male(Father),
> 
> 
> 
> 
> 
> siblings(Father,Mother) :- 
> 
> is_father(X, Father), 
> 
> is_mother(X, mother).
> 
> 
> So father and mother has siblings if father is the father of X and mother is the mother of X. 
> 
> 
> But still errors like this: User throw: error(system_error, [type = exec, rc = 427, message = `Syntax error: Probable missplaced period around: (is_mother(H223, H224) :- parent(H224, H223) , female(H224) , is_father(H223, H240)) :- parent(H240, H223) , male(H240) , siblings(H240, H224)`, predicate = `err$exec/4`, callstack = `- catch/3;+ catch/3;- consult/1;--- top of stack ---`])
> 
> 
> Roelof
> 
> ----------------------------------------
>> Subject: Re: [SWIPL] Siblings of parents
>> From: [email protected]
>> Date: Sat, 8 Mar 2014 17:35:22 +0100
>> To: [email protected]
>> 
>> 
>> On 8 Mar 2014, at 17:29 , Roelof Wobben <[email protected]> wrote:
>> 
>>> siblings(F,M) :-
>>> 
>>> father(X)
>>> 
>>> mother(X).
>>> 
>>> 
>>> 
>>> So I thougth to display if parents have siblings X have to have a father and a mother.
>> 
>> Check the meaning of these clauses. Do they express what you want to express?
>> 
>> Another suggestion: Have a look at http://www.learnprolognow.org to get the basics of Prolog.
>> 
>> --- nef
>> 		 	   		  
> _______________________________________________
> SWI-Prolog mailing list
> [email protected]
> https://lists.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.