![]() |
YAP 7.1.0
|
nb_setarg(+{Arg], + Term, + Value) More...
nb_setarg(+{Arg], + Term, + Value)
Assigns the Arg-th argument of the compound term Term with the given Value as setarg/3 , but on backtracking the assignment is not reversed If Term is not atomic, it is duplicated using duplicate_term/2 This predicate uses the same technique as nb_setval/2 We therefore refer to the description of nb_setval/2 for details on non-backtrackable assignment of terms This predicate is compatible to GNU-Prolog setarg(A,T,V,false)
, removing the type-restriction on Value See also nb_linkarg/3 Below is an example for counting the number of solutions of a goal Note that this implementation is thread-safe, reentrant and capable of handling exceptions Realising these features with a traditional implementation based on assert/retract or flag/3 is much more complicated