Availability:built-in
nb_linkval(+Name,
+Value)Associates the term Value with the atom Name
without copying it. This is a fast special-purpose variation of nb_setval/2
intended for expert users only because the semantics on backtracking to
a point before creating the link are poorly defined for compound terms.
The principal term is always left untouched, but backtracking behaviour
on arguments is undone if the original assignment was trailed
and left alone otherwise, which implies that the history that created
the term affects the behaviour on backtracking. Consider the following
example:
demo_nb_linkval :-
T = nice(N),
( N = world,
nb_linkval(myvar, T),
fail
; nb_getval(myvar, V),
writeln(V)
).