ADDED: portray_clause/2, writing to a specified stream.
This commit is contained in:
@@ -396,7 +396,7 @@ The modules that ship with Scryer Prolog are also called
|
|||||||
* [`format`](src/lib/format.pl)
|
* [`format`](src/lib/format.pl)
|
||||||
The nonterminal `format_//2` is used to describe formatted output,
|
The nonterminal `format_//2` is used to describe formatted output,
|
||||||
arranging arguments according to a given format string.
|
arranging arguments according to a given format 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.
|
provide formatted *impure* output.
|
||||||
* [`assoc`](src/lib/assoc.pl)
|
* [`assoc`](src/lib/assoc.pl)
|
||||||
providing `empty_assoc/1`, `get_assoc/3`, `put_assoc/4` etc.
|
providing `empty_assoc/1`, `get_assoc/3`, `put_assoc/4` etc.
|
||||||
|
|||||||
@@ -74,6 +74,7 @@
|
|||||||
format/2,
|
format/2,
|
||||||
format/3,
|
format/3,
|
||||||
portray_clause/1,
|
portray_clause/1,
|
||||||
|
portray_clause/2,
|
||||||
listing/1
|
listing/1
|
||||||
]).
|
]).
|
||||||
|
|
||||||
@@ -465,8 +466,12 @@ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
|||||||
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||||
|
|
||||||
portray_clause(Term) :-
|
portray_clause(Term) :-
|
||||||
|
current_output(Out),
|
||||||
|
portray_clause(Out, Term).
|
||||||
|
|
||||||
|
portray_clause(Stream, Term) :-
|
||||||
phrase(portray_clause_(Term), Ls),
|
phrase(portray_clause_(Term), Ls),
|
||||||
maplist(write, Ls).
|
maplist(put_char(Stream), Ls).
|
||||||
|
|
||||||
portray_clause_(Term) -->
|
portray_clause_(Term) -->
|
||||||
{ term_variables(Term, Vs),
|
{ term_variables(Term, Vs),
|
||||||
|
|||||||
Reference in New Issue
Block a user