Re: [eclipse-users] to recover the state of a variable when the predicate is used “tent_set”, library “repair"

From: Kish Shen <kisshen_at_cisco.com>
Date: Wed, 10 Oct 2007 23:58:59 +0100
Hi,

m.alejandro wrote:
> hi....
>
> I wanted to know like recovering the original state of a variable, 
> after applying to the predicate "tent_set". For example:
>
>
> ?- X1::1..3, X1 tent_set 2,write(X1).
>         ... X1{repair:2, fd:[1..3]}
>
>  
> X1 =    X1{[1..3]}      -------[tent_set 2 ]----->      X1{repair:2, 
> fd:[1..3]}      -----[????]------>      X1{[1..3]}
>
> bye...
tent_set/2 (in both lib(tentative) and lib(repair) behaves `logically', 
i.e. the setting is undone on backtracking,
so to `recover' the original value, the easiest way is to backtrack over 
the tent_set.

If you really want to remove a tentative attribute while in forward 
execution, you can't do this (at least without hacking the library code 
itself). Is there any reason why you want to do this? You can change the 
tentative value of a variable, though, so if you want to set a variable 
to a previous tentative value, you can remember the previous value and 
then set the variable to this when you want to.

Cheers,

Kish
Received on Wed Oct 10 2007 - 23:59:08 CEST

This archive was generated by hypermail 2.2.0 : Thu Feb 02 2012 - 02:31:58 CET