The output of the “Write” predicates is not terminated by a full-stop;
therefore, if you want the term to be acceptable as input to
you must send the terminating full-stop to the output stream yourself. For example,
| ?- write(a), put_code(0'.), nl.
If Term is uninstantiated, it is written as an anonymous variable (an underscore followed by a non-negative integer).
write_canonical/[1,2] is provided so that Term, if written to a
file, can be read back by
read/[1,2] regardless whether there are special
characters in Term or prevailing operator declarations.