
explain.pl -- Describe Prolog Terms
The library(explain) describes prolog-terms. The most useful
functionality is its cross-referencing function.
?- explain(subset(_,_)).
"subset(_, _)" is a compound term
from 2-th clause of lists:subset/2
Referenced from 46-th clause of prolog_xref:imported/3
Referenced from 68-th clause of prolog_xref:imported/3
lists:subset/2 is a predicate defined in
/staff/jan/lib/pl-5.6.17/library/lists.pl:307
Referenced from 2-th clause of lists:subset/2
Possibly referenced from 2-th clause of lists:subset/2
Note that PceEmacs can jump to definitions and gxref/0 can be used for
an overview of dependencies.
explain(@Term) is det- Give an explanation on Term. Term can be any Prolog data object.
Some terms have a specific meaning:
- A (partial) reference to a predicate gives the predicates,
its main properties and references to the predicates. Partial
references are:
- Module:Name/Arity
- Module:Head
- Name/Arity
- Name//Arity
- Name
- Module:Name
- Some predicate properties. This lists predicates as above
the have this property. The specification can be of the
shape
Module:Property
or just Property. The qualified
version limits the result to predicates defined in Module.
Supported properties are:
- dynamic
- thread_local
- multifile
- tabled
explain(@Term, -Explanation) is nondet- True when Explanation is an explanation of Term. The explaination is
a list of elements that is printed using
print_message(information,
explain(Explanation))
.
known_predicate(:Head)[private]- Succeeds if we know anything about this predicate. Undefined
predicates are considered `known' for this purpose, so we can
provide referenced messages on them.
explain_property(+Property, ?Module, -Explanation) is nondet[private]- Explain predicates that have some property. Only does user
predicates.
explain_predicate(:Head, -Explanation) is det[private]