Re: why does this not work

Roelof Wobben <[email protected]>
Newsgroups gmane.comp.ai.prolog.swi
Message-ID <[email protected]>

> Date: Tue, 25 Mar 2014 15:40:53 +0100
> From: [email protected]
> To: [email protected]
> Subject: Re: [SWIPL] why does this not work
> 
> On Tue, Mar 25, 2014 at 14:32:03 +0000, Roelof Wobben wrote:
> > % Displays the output of siblings(X,Y) and takes care that 
> > % there are no duplicates.
> > display_siblings(Person) :-
> >       findall(Person-Y, (siblings(Person,Y),Person @< Y), Sibs),
> >        display_the_siblings(Sibs).
> > [...]
> > But when I do display_siblings(kimberly) I see a message Er zijn geen zussen/broers bekend
> > That's wrong Denise is a sibling of Kimberly.
> 
> ?- Person = kimberly, findall(Person-Y, (siblings(Person,Y),Person @< Y), Sibs).
> Person = kimberly,
> Sibs = [].
> 
> ?- Person = kimberly, findall(Person-Y, (siblings(Person,Y)), Sibs).
> Person = kimberly,
> Sibs = [kimberly-denise].

Thanks, 

It's working now. 
But still one problem.

when there are more then 1 solution then this schould happens.

% Display a message if there are more then 1 siblings found.
display_the_siblings([H|T]) :-
        XYs0=[H,T],
        write('Alle zusterparen zijn : \n'),
        forall(( member(X - Y,XYs0)
       ),( format('~w en ~w. \n',[X,Y])
        )).

But it displays only the first solution and not the others.

How to change this ?

Roelof

 		 	   		  
-------------- next part --------------
HTML attachment scrubbed and removed
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.