Next: mpg-ref-portray_message, Previous: mpg-ref-portray, Up: mpg-bpr [Contents][Index]
portray_clause/[1,2]portray_clause(+Clause)
portray_clause(+Stream, +Clause)
Writes Clause to the current output stream. Used by
listing/[0,1].
stream_object, must be ground
A valid open Prolog stream, defaults to the current output stream.
term
The operation used by listing/[0,1]. Clause is written
to Stream, in exactly the format in which listing/[0,1]
would have written it, including a terminating full stop.
If you want to print a clause, then this is almost certainly the
command you want. By design, none of the other term output
commands puts a full stop after the written term.
If you are writing a file of facts to be loaded by
the Load Predicates, then use portray_clause/[1,2], which attempts
to ensure that the clauses it writes out can be read in again as clauses.
The output format used by portray_clause/[1,2] and listing/[0,1] has
been carefully designed to be clear. We recommend that you use a
similar style. In particular, never put a semicolon
(disjunction symbol) at the end of a line in Prolog.
Stream errors (see ref-iou-sfh-est).
| ?- portray_clause((X:- a -> b ; c)).
_ :-
( a ->
b
; c
).
| ?- portray_clause((X:- a -> (b -> c ; d ; e); f)).
_ :-
( a ->
( b ->
c
; d
; e
)
; f
).
| ?- portray_clause((a:-b)).
a :-
b.
| ?- portray_clause((a:-b,c)).
a :-
b,
c.
| ?- portray_clause((a:-(b,!,c))).
a :-
b, !,
c.
listing/[0,1], ref-iou-tou.