listing/[0,1]
listing
listing(
+PredSpecs)
Prints the clauses of all the dynamic procedures currently in the
Prolog database, or of PredSpecs, to the current output stream,
using portray_clause/1
.
If Predicate is an atom, then listing/1
lists the dynamic
procedures for all predicates of that name, as for listing/0
If PredSpecs is a predicate specification of the form Name/Arity, only the clauses for the specified predicate are listed.
PredSpecs can be a list of predicate specifications and/or atoms; for example,
| ?- listing([concatenate/3, reverse, go/0]).
You 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).
Under the Emacs interface, there is a facility
for finding the source code definition for a specified compiled or
dynamic procedure and reading it into an edit buffer. This is likely
to be more helpful than listing/1
in most cases. See
ema-emi-key for more information.