11.3.116 listing/[0,1]

Synopsis

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.

Arguments

:PredSpecs

pred_spec_tree

A predicate specification, or a list of such.

Exceptions

type_error

PredSpecs of the wrong type.

Examples

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).

See Also

ref-mod.


Send feedback on this subject.