listing/[0,1]listing
listing(+PredSpecs)
Prints the clauses of all the interpreted procedures currently in the
type-in module of the Prolog database, or of PredSpecs, to the
current output stream, using portray_clause/1.
A predicate specification, or a list of such.
type_errorYou could list the entire program to a file using the command
| ?- tell(file), listing, told.
Note that listing/[0,1] does not work on compiled procedures.
listing/1 is dependent on the source module. As a special case,
| ?- listing(mod:_).
will list all the dynamic predicates in module mod. However,
listing/0 is not dependent on the source module; it refers instead
to the type-in module.
Variables may be included in predicate specifications given to
listing/1. For example, you can list clauses for f in any
current module with:
| ?- listing(_:f).