Exceptions:
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.
Outputs +Term to the current output (write_term/2) or to Stream (write_term/3) according to the list of write options, Options. The current set of write options which form a superset of the ISO-standard write options, are as follows:
From the following examples it can be seen that write_term/{2,3} can duplicate the behavior of a number of other I/O predicates such as writeq/{1,2}, write_canonical/{1,2}, etc.
| ?- write_term(f(1+2,'A',"string",'$VAR'(3),'$VAR'('Temp'),(multifile foo)),[]). f(1 + 2,A,"string",$VAR(3),$VAR(Temp),(multifile foo)) yes | ?- write_term(f(1+2,'A',"string",'$VAR'(3),'$VAR'('Temp'),(multifile foo)), [quoted(true)]). f(1 + 2,'A',"string",'$VAR'(3),'$VAR'('Temp'),(multifile foo)) yes | ?- write_term(f(1+2,'A',"string",'$VAR'(3),'$VAR'('Temp'),(multifile foo)), [quoted(true),ignore_ops(true),numbervars(true)]). f(+(1,2),'A','.'(115,'.'(116,'.'(114,'.'(105,'.'(110,'.'(103,[])))))),D,Temp,(multifile foo)) yes | ?- write_term(f(1+2,'A',"string",'$VAR'(3),'$VAR'('Temp'),(multifile foo)), [quoted(true),ignore_ops(true),numbervars(true),priority(1000)]). f(+(1,2),'A','.'(115,'.'(116,'.'(114,'.'(105,'.'(110,'.'(103,[])))))),D,Temp,multifile(foo)) yes
'\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
as '.'(foo,'.'(bar,[]))
).