Common Characteristics

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 read/[1,2], you must send the terminating full-stop to the output stream yourself. For example,

| ?- write(a), write(' .'), nl.

Note that, in general, you need to prefix the full-stop with a layout character, like space, to ensure that it can not “glue” with characters in the term.

If Term is uninstantiated, it is written as an anonymous variable (an underscore followed by a non-negative integer).

Please note: The “name” used when writing a variable may differ between separate calls to a ‘Write“ predicate. If this is a concern, you can use either of the following methods to ensure that the variable is always written in same way.

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.

Send feedback on this subject.