All proper HiLog terms (HiLog terms which are not also Prolog terms) are not written in their internal Prolog representation. Predicate write/1 always succeeds without producing an error.
The HiLog terms that are output by write/1 cannot in general be read back using read/1. This happens for two reasons:
Predicate write/1 treats terms of the form
'$VAR'(N) specially: it writes 'A' if N=0,
'B' if N=1, , 'Z' if N=25, 'A1'
if N=26, etc. Terms of this form are generated by
numbervars/[1,3] described in the section Library Utilities in Volume 2.
'$VAR'(N)the same way as write/1, writing A if N= 0, etc.
writeq/1 always succeeds without producing an error.
Unlike writeq/1, write_canonical/1 does not treat terms
of the form
'$VAR'(N) specially. It writes square bracket lists
using '.'/2 and  (that is, [foo, bar] is written