[ Term I/O | Reference Manual | Alphabetic Index ]
portray_term(?Term, -TransTerm, +As)
Apply portray (write) transformations to Term
- A term.
- A variable.
- One of the atoms 'term', 'goal' or 'clause'
Applies portray-transformations to Term, if any are visible in the
caller module. If no transformation is visible, TransTerm is identical
This predicate is intended mainly for testing purposes, because
portray-transformations are normally performed implicitly by the
term output predicates write/1,2, writeln/1,2, print/1,2,
display/1,2, printf/2,3 or write_term/2,3.
Modes and Determinism
- portray_term(?, -, +) is det
This predicate is sensitive to its module context (tool predicate, see @/2).
% Given the program:
:- local portray(s/1, tr_s/2, ).
tr_s(s(S), N) :- tr_s(S, N1), N is N1+1.
% Implicit portray transformation by write/1:
?- S = s(s(s(0))), write(S).
% Explicit portray transformation
% Note: no transformation done by writeq/1
?- S = s(s(s(0))), writeq(S), portray_term(S, P, term), writeq(P).
portray / 3, expand_clause / 2, expand_goal / 2, expand_macros / 2