« Return to Thread: Forall in SWI Prolog

Forall in SWI Prolog

by Fatih TURKMEN-2 :: Rate this Message:

Reply to Author | View in Thread


Dear All,

I am running into a problem with forall predicate of SWI-Prolog. I have the following predicate that tries to match all subjectMatch(....) with rSub(...). This makes sure all different combinations of subjectMatch(...) facts with different RID and RValue values are matched. However, forall returns True when the Condition section of forall predicate is not matched. That means if there is no fact matching the condition of forall (that is subjectMatch(P,R,N,RID,RValue)) forall returns True as a default value.    

subjectS(P,R,N)  :-  forall(subjectMatch(P,R,N,RID,RValue),
              rSub(RID,RValue)).

Is there a way to get around this? I mean if the condition of forall is not matched at all, how can I get a false?

Any suggestions are welcome.

Thanks in advance.

--
Fatih Turkmen


     
_______________________________________________
SWI-Prolog mailing list
SWI-Prolog@...
https://mailbox.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog

 « Return to Thread: Forall in SWI Prolog