Among others. The key functionality is provided by numbervars/4 using the option singletons(true)
. That assigns normal variables '$VAR'(N)
, where N is a positive integer and singletons '$VAR'('_')
. From there on the numbervars(true)
option of write_term/2 prints the variables as A
, B
or _
.
Although write_canonical/1 using the same algorithm, it doesn’t actually use numbervars/4 as it is required to print '$VAR'(N)
terms as-is.