Writes Term on the standard output stream, subject to +Options.
A valid open Prolog stream, defaults to the current output stream.
A list of zero or more of the following,
where Boolean must be
Any output produced by
write_term/2 with the option
quoted(true) will be in Normal Form C, as defined by
Unicode. See ref-syn-syn-tok for further details.
user:portray/1is called for each non-variable subterm.
)where N is an integer >= 0, an atom, or a code-list, are treated specially (see
@/2notation, as discussed above.
quoted(true)holds. Charset should be a legal value of the
quoted_charsetProlog flag, where it takes its default value from.
write_canonical/1selects the value
portable. See ref-lps-flg.
format/[2,3]character sequences for printing floats. The default is ‘~H’.
This predicate subsumes the predicates that output terms except
portray_clause/[1,2], which additionally prints a period and a
newline, and removes module prefixes that are redundant wrt. the
current type-in module.
During debugging, goals are written out by this predicate with options
given by the
debugger_print_options Prolog flag.
Top-level variable bindings are written out by this predicate with options
given by the
toplevel_print_options Prolog flag.
Stream errors (see ref-iou-sfh-est), plus:
How certain options affect the output of
| ?- write_term('a b', [quoted(true)]). 'a b' | ?- write_term(a+b, [ignore_ops(true)]). +(a,b) | ?- write_term(f('$VAR'(2)), [numbervars(true)].) f(C) | ?- write_term(f('$VAR'('C')), [numbervars(true)]). f(C)
If your intention is to name variables such as that
read_term/2 with the variable_names
option then this can be done by defining a predicate
var_to_names() :- !. var_to_names([=(Name,Var)|RestofPairs]) :- ( var(Var) -> Var = '$VAR'(Name) ; true ), var_to_names(RestofPairs). | ?- read_term([variable_names(Names)], X), var_to_names(Names), write_term(X, [numbervars(true)]), nl, fail. |: a(X, Y). a(X, Y). no