[ Term I/O | Reference Manual | Alphabetic Index ]

display(+Stream, ?Term)

Term is displayed on the output stream Stream --- without considering operator definitions.
Stream
Stream handle or alias (atom)
Term
Prolog term.

Description

Used to display an expression in standard parenthesised prefix notation, onto the output stream Stream.

display(S, Term) is equivalent to write_term(S, Term, [operators(false), dotlists(true)]).

Note that as usual, the output is buffered, so it may need to be flushed either by closing the stream, by writing again or by using flush/1.

Modes and Determinism

Exceptions

(4) instantiation fault
Stream is not instantiated.
(5) type error
Stream is not an atom or a stream handle.
(192) illegal stream mode
Stream is not an output stream.
(193) illegal stream specification
Stream is an illegal stream specification.

Examples

Success:
      display(output, 3.0).                % displays 3.0
      set_stream(a,output), display(a,hi). % displays hi

      ?- open(file1,update,S), display(S, X+2), close(S).
      X = _72
      S = 6
      yes.
      ?- sh('cat file1').
      +(_98, 2)
      yes.
Error:
      display(S, a(b,c)).        (Error 4).
      display("string", a(b,c)). (Error 5).
      display(9, X=2).           (Error 192). % stream not open
      display(atom, X=2).        (Error 193).



See Also

display / 1, write / 1, write / 2