Did you know ... | Search Documentation: |
Predicate print/1 |
print(Term) :- current_prolog_flag(print_write_options, Options), !, write_term(Term, Options). print(Term) :- write_term(Term, [ portray(true), numbervars(true), quoted(true) ]).
The print/1
predicate is used primarily through the ~p
escape sequence
of format/2,
which is commonly used in the recipes used by
print_message/2
to emit messages.
The classical definition of this predicate is equivalent to the ISO
predicate write_term/2
using the options portray(true)
and
numbervars(true)
. The portray(true)
option
allows the user to implement application-specific printing of terms
printed during debugging to facilitate easy understanding of the output.
See also
portray/1
and library(portray_text)
. SWI-Prolog adds quoted(true)
to (1) facilitate the copying/pasting of terms that are not affected by
portray/1
and to (2) allow numbers, atoms and strings to be more easily
distinguished, e.g., 42
, '42'
and "42"
.