A.23 library(listing): List programs and pretty print clauses
AllApplicationManualNameSummaryHelp

  • Documentation
    • Reference manual
      • The SWI-Prolog library
        • library(listing): List programs and pretty print clauses
          • listing/0
          • listing/1
          • listing/2
          • portray_clause/1
          • portray_clause/2
          • portray_clause/3
    • Packages
Availability::- use_module(library(listing)).(can be autoloaded)
Source[det]portray_clause(+Clause)
[det]portray_clause(+Out:stream, +Clause)
[det]portray_clause(+Out:stream, +Clause, +Options)
Portray‘Clause’on the current output stream. Layout of the clause is to our best standards. Deals with control structures and calls via meta-call predicates as determined using the predicate property meta_predicate. If Clause contains attributed variables, these are treated as normal variables.

Variable names are by default generated using numbervars/4 using the option singletons(true). This names the variables A, B, ... and the singletons _. Variables can be named explicitly by binding them to a term '$VAR'(Name), where Name is an atom denoting a valid variable name (see the option numbervars(true) from write_term/2) as well as by using the variable_names(Bindings) option from write_term/2.

Options processed in addition to write_term/2 options:

variable_names(+Bindings)
See above and write_term/2.
indent(+Columns)
Left margin used for the clause. Default 0.
module(+Module)
Module used to determine whether a goal resolves to a meta predicate. Default user.