11.3.154 portray/1 [hook]

Synopsis

:- multifile user:portray/1.

user:portray(+Term)

A way for the user to over-ride the default behavior of print/1.

Arguments

Term
term

Description

If user:portray/1 is defined, then the predicates listed below performing term output will call it on the term itself and on every non-variable subterm T. If user:portray/1 succeeds, it is assumed to have written T. If it fails, the calling predicate will write the principal functor of T and treat the arguments of T recursively.

Note that on lists ([_|_]), user:portray/1 will be called on the whole list to user:portray/1 and, if that call fails, on each list element, but not on every tail of the list.

The affected predicates are:

print/[1,2]
write_term/[2,3]
when used with the option portrayed(true)
goals during debugging
controlled by the debugger_print_options Prolog flag, whose value by default includes portrayed(true)
top-level variable bindings
controlled by the toplevel_print_options Prolog flag, whose value by default includes portrayed(true)

Exceptions

Exceptions are treated as failures, except an error message is printed also

See Also

ref-iou-tou.


Send feedback on this subject.