Given the following minimalistic "solver" in SICStus Prolog ...
:- module(attach, [attach/1]). :- use_module(library(atts)). :- attribute a/0. attach(X) :- put_atts(X,a). verify_attribute(_,_,[]). attribute_goal(V,attach(V)) :- get_atts(V,a), put_atts(V,-a).
... I observe:
| ?- attach(X), copy_term(X,Xc,Xcc), copy_term(X,Yc,Ycc). Xcc = attach:attach(Xc), Ycc = true ?
Where has the residual goal gone?!
Wasn't the put_atts/2
in attribute_goal/2
undone?
Edit. This previous answer (of a somewhat related question) hints at a similar issues when using the builtin predicate when/2
.