Re: forall implementation
- From: bart demoen <bmd@xxxxxxxxxxxxxx>
- Date: Thu, 14 Sep 2006 23:10:22 +0200
On Thu, 14 Sep 2006 19:26:24 +0200, Carlo Capelli wrote:
I found the following code in SWI-Prolog:
forall(A, B) :-
\+((
A,
\+B
)).
Very nice, and the predicate is worth to use, but PSharp can't compile it (I
think it goes into loop, having seen the memory footprint...).
I renamed the predicate in the following way, because PSharp use forall in
LLP context,
runall(A, B) :-
\+((
call(A),
\+B
)).
but it doesn't work.
It is not clear what you are asking: there seems to be a bug in PSharp
and you want us to find a way around it ? You should ask Jon Cook directly
about bugs in P#.
My simple minded replacement obviously doesn't work:
runall(A, B) :-
repeat,
runall_(A, B).
runall_(A, B) :-
call(A),
call(B),
fail.
runall_(_, _).
Sure, your replacement obviously does not work. What do you expect ?
Prolog code that circumvents the P# bug ?
Maybe the following will work: since we know that \+ can be implemented
by
\+(G) :- call(G), !, fail.
\+(_).
try expanding (or inlining, or unfolding) this definition in the original
def of forall.
Show us what you get :-)
Cheers
Bart Demoen
.
- Follow-Ups:
- Re: forall implementation
- From: Carlo Capelli
- Re: forall implementation
- From: Carlo Capelli
- Re: forall implementation
- References:
- forall implementation
- From: Carlo Capelli
- forall implementation
- Prev by Date: Re: no backtrack
- Next by Date: Re: The n-knights problem
- Previous by thread: forall implementation
- Next by thread: Re: forall implementation
- Index(es):
Relevant Pages
|
|