[m-dev.] Trailing

Fergus Henderson fjh at cs.mu.oz.au
Tue Aug 12 20:39:20 AEST 1997


Peter Schachte, you wrote:
> 	:- pred p(array::mdi, int::out) is det;
> 
> 	p(A, Z) :-
> 		(   mangle_array(A, A1),
> 		    test(A1) ->
> 			q(A1, Z)
> 		;   q(A, Z)
> 		).
> 
> (mdi and muo mean mostly destructive in and mostly unique out.)  Unless I'm
> missing something, this should be possible, and will require
> trailing.

That's correct.

> But there's no nondet frame to tie the trail to!  I don't
> know how to handle this one, other than to force the compiler to
> create an artificial choicepoint before the call to mangle_array/2,
> and have the call to test/1 either backtrack into it or cut it away.
> Is there an better alternative I don't see?

Hmm.  The current implementation handles this by attaching trailing
information to "tickets" (stored on a ticket stack) rather than to
choice points.  Perhaps that is not such a bad design after all?

-- 
Fergus Henderson <fjh at cs.mu.oz.au>   |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>   |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3         |     -- the last words of T. S. Garp.



More information about the developers mailing list