portray_clause/1

Synopsis

portray_clause(+Clause)

Writes Clause to the current output stream. Used by listing/[0,1].

Arguments


Clause term

Description

The operation used by listing/0 and listing/1. Clause is written to the current output stream in exactly the format in which listing/1 would have written it, including a terminating full-stop.

If you want to print a clause, 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, use portray_clause/1, 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 and listing/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.

Exceptions

Always succeeds without error.

Example

     | ?- portray_clause((X:- a -> b ; c)).
     A :-
             (   a ->
                 b
             ;   c
             ).
     
     X = _3185
     
     | ?- portray_clause((X:- a -> (b -> c ; d ; e); f)).
     A :-
             (   a ->
                 (   b ->
                     c
                 ;   d
                 ;   e
                 )
             ;   f
             ).
     
     X = _3295
     
     | ?- portray_clause((a:-b)).
     a :-
             b.
     
     yes
     
     | ?- portray_clause((a:-b,c)).
     a :-
             b,
             c.
     
     yes
     
     | ?- portray_clause((a:-(b,!,c))).
     a :-
             b,
             !,
             c.
     
     yes
     

See Also

listing/[0,1], read/[1,2] ref-iou-tou-pcl