Thank you very much for your prompt response. I didn't understand the reason behind True in the case of Condition mismatch of Forall. Is there an explanation that I can foresee or just an implementation issue? I am not aware if Sics says anything about this.
Thanks.
--
Fatih Turkmen
--- On Sat, 7/4/09, Paulo Moura <
pmoura@...> wrote:
> From: Paulo Moura <
pmoura@...>
> Subject: Re: [SWIPL] Forall in SWI Prolog
> To: "Prolog ML" <
swi-prolog@...>
> Date: Saturday, July 4, 2009, 8:05 PM
>
> On 2009/07/04, at 17:48, Fatih TURKMEN wrote:
>
> >
> > 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?
>
>
> subjectS(P, R, N) :-
> \+ \+ subjectMatch(P, R, N, _, _),
> forall(subjectMatch(P, R, N, RID,
> RValue), rSub(RID, RValue)).
>
> Cheers,
>
> Paulo
>
>
> -----------------------------------------------------------------
> Paulo Jorge Lopes de Moura, PhD
> Assistant Professor
> Dep. of Computer Science, University of Beira Interior
> 6201-001 Covilhã, Portugal
>
> Office 3.18 Ext. 3276
> Phone: +351 275319891 Fax: +351 275319899
> Email: <mailto:
pmoura@...>
>
> Home page: <
http://www.di.ubi.pt/~pmoura>
> Research: <
http://logtalk.org/> Blog: <
http://blog.logtalk.org/>
> -----------------------------------------------------------------
>
> _______________________________________________
> SWI-Prolog mailing list
>
SWI-Prolog@...
>
https://mailbox.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog>
_______________________________________________
SWI-Prolog mailing list
SWI-Prolog@...
https://mailbox.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog