This predicate sets up a demon that prints a message whenever the tentative value of one of the variables in ArrayList changes. The message is printed onto Stream and is of the form
Name[Index]: chg(Old,New)
where Index is the index of the changed variable in the given array, Old is the tentative value before the change, and New the tentative value after the change.
Another way of tracing tentative value changes is by using the Visualisation Tools.
?- Xs = [X,Y], tent_set(Xs, [1,2]), tent_trace_array(output, hello, Xs), tent_set(X, 7), tent_set(Y, 3), tent_set([X,Y], [5,5]). hello[1]: chg(1, 7) hello[2]: chg(2, 3) hello[1]: chg(7, 5) hello[2]: chg(3, 5) Xs = [X{5 -> 0}, Y{5 -> 0}] There are 2 delayed goals. Yes (0.02s cpu)