[m-dev.] Tabling [1/3]

Oliver Hutchison ohutch at students.cs.mu.OZ.AU
Tue Mar 10 17:06:41 AEDT 1998


> 
> > > > compiler/simplify.m:
> > > > 	Only report infinite recursion warning if a procedure has
> > > > 	normal evaluation.
> > > 
> > > I think it would probably still be useful to issue this warning at
> > > compile time even if there is a `pragma loopcheck', because in general
> > > compile-time warnings are better than run-time errors.
> > 
> > What about the case of memoing. It is then possible that the call will not
> > lead to infinite recursion? 
> 
> I don't think so.  I think that a recursive call with the same input
> arguments will still always lead to infinite recursion, even with
> memoing.  Isn't that correct?
>  

No. Memoing will suspend the recursive call and then feed answers back to
it through the resumption mechanism until there are no answers pending.
Minimal model will fail at the recursive call.
 
Given the predicates :

:- mode p(in, out) is nondet.
 
p(A, B) :- e(A, B).
p(A, B) :- p(A, C), e(C, B).
 
e(1, 2).
e(2, 3).
 
and the call : 

p(1, A).

The check in simplify will see the left recursive call and issue the
message but if the predicate p has memo or minimal evaluation it will
terminate. The memo version will return A = 2 ; 3 and the minimal
version A = 2. 
 




More information about the developers mailing list