]> Repositorios git - scryer-prolog.git/commitdiff
ADDED: portray_clause/2, writing to a specified stream.
authorMarkus Triska <[email protected]>
Sat, 13 Jun 2020 14:45:47 +0000 (16:45 +0200)
committerMarkus Triska <[email protected]>
Sat, 13 Jun 2020 14:45:47 +0000 (16:45 +0200)
README.md
src/lib/format.pl

index f60ee75a619f8b59e0bedf36129a97ca56a54d69..f05c0640a672e360197139fe19d34f750084744b 100644 (file)
--- a/README.md
+++ b/README.md
@@ -396,7 +396,7 @@ The modules that ship with Scryer&nbsp;Prolog are also called
 * [`format`](src/lib/format.pl)
   The nonterminal `format_//2` is used to describe formatted output,
   arranging arguments according to a given format&nbsp;string.
-  The predicates `format/[2,3]`, `portray_clause/1` and `listing/1`
+  The predicates `format/[2,3]`, `portray_clause/[1,2]` and `listing/1`
   provide formatted *impure* output.
 * [`assoc`](src/lib/assoc.pl)
   providing `empty_assoc/1`, `get_assoc/3`, `put_assoc/4` etc.
index e8be4df3ad56e85e7bbb262f92944f64a615f5f5..2e496730329867324877e3cd5b51bfc3ecbf76bd 100644 (file)
@@ -74,6 +74,7 @@
                    format/2,
                    format/3,
                    portray_clause/1,
+                   portray_clause/2,
                    listing/1
                   ]).
 
@@ -465,8 +466,12 @@ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 
 portray_clause(Term) :-
+        current_output(Out),
+        portray_clause(Out, Term).
+
+portray_clause(Stream, Term) :-
         phrase(portray_clause_(Term), Ls),
-        maplist(write, Ls).
+        maplist(put_char(Stream), Ls).
 
 portray_clause_(Term) -->
         { term_variables(Term, Vs),