[] prior to
backtrackable assignment. Starting with version 9.3.18, if the new Value
contains the old value, the old value is not copied. This implies
that push/1 below has complexity O(1), regardless of the length of the
list
Old.
push(Var, Value) :-
nb_getval(Var, Old),
nb_setval(Var, [Value|Old]).