documentation needs help
"Equivalent to write_term/2 using the options
numbervars after numbervars/4 using the
This should be reformulated to:
"Equivalent to transforming Term with numbervars/4 using the
singletons option, followed by write_term/2 using the options
?- Term = f(X,Y,X), write_canonical(Term). f(A,_,A) Term = f($VAR(X),$VAR(Y),$VAR(X)).
Same as (note that variables in Term are unified with $VAR/N terms):
?- Term = f(X,Y,X), numbervars(Term, 0, End, [singletons(true)]), write_term(Term, [ignore_ops(true),quoted(true),numbervars(true)]). f(A,_,A) Term = f($VAR(0),$VAR(_),$VAR(0)), X = $VAR(0), Y = $VAR(_), End = 1.
See also numbervars/3 for more comment.
"This used to be the case anyhow, as garbage collection between multiple calls to one of the write predicates can change the _G<NNN> identity of the variables."
But variables are now just printed as `_$INTEGER`.