Re: Newbie question...simple rule question...



On 2005-08-11, mans <mshapshak@xxxxxxxxx> wrote:
> Dear All,
>
> I am trying to understand the best way to write a rule which checks on
> all the elements.
>
> -------------
> people(a).
> people(c).
> ok(b).
> ok(a).
>
> everybodyok_works :- findall(X,ok(X),List),maplist(people,List).
>
> everybodyok_bad :- people(X),ok(X).
>
> -------------
>
> What am I missing? Is there a better way to write rule which says:
> "Everybody is ok if for all people we know has said they are OK." ?

Prolog tries to find instances that satisfy some condition. Think
from the other side. Everybody is ok iff there is nobody who is not
ok.

Cheers --- Jan
.



Relevant Pages