4.5 List the program, predicates or clauses
AllApplicationManualNameSummaryHelp

  • Documentation
    • Reference manual
      • Built-in Predicates
        • List the program, predicates or clauses
          • listing/1
          • listing/0
          • portray_clause/1
          • portray_clause/2
    • Packages
Availability::- use_module(library(listing)).(can be autoloaded)
Sourcelisting(:Pred)
List predicates specified by Pred. Pred may be a predicate name (atom), which lists all predicates with this name, regardless of their arity. It can also be a predicate indicator (<name>/<arity> or <name>//<arity>), possibly qualified with a module. For example: ?- listing(lists:member/2)..

A listing is produced by enumerating the clauses of the predicate using clause/2 and printing each clause using portray_clause/1. This implies that the variable names are generated (A, B, ... ) and the layout is defined by rules in portray_clause/1.