PLOGHELP PREDICATE_INFO                        Robert Duncan, March 1988
                                                       Revised July 1993

Determining the status of a predicate.

    ?- predicate_info(____Spec, ____Info).


predicate_info/2 reports on the status of the predicate denoted by ____Spec.
____Spec must be a term of the form:

    __Fn/_____Arity

where __Fn is an atom (representing the functor name of a predicate) and
_____Arity an integer (its arity). ____Info is then bound to a list of terms
giving information about that predicate. A call to predicate_info/2 will
always succeed.

The ____Info list will contain a subset of the following atoms:

    _________undefined
        The predicate is undefined: either no procedure definition has
        been read for the predicate, or it has since been abolished. If
        called, the predicate will raise an 'UNDEFINED PREDICATE' error.
        See ________PLOGHELP * _______UNKNOWN.

    _________nonprolog
        The predicate has been defined from outside Prolog, e.g. in
        Pop-11, using prolog_valof (see ________PLOGHELP * ____________PROLOG_VALOF).

    _______dynamic
        The predicate is dynamic: either it has been explicitly declared
        with dynamic/1 or it has become dynamic because of compilation
        defaults or because it has been asserted or retracted. See
        ________PLOGHELP * _______DYNAMIC.

    ______static
        The predicate is static: either it has been explicitly declared
        with static/1 or it has become static because of compilation
        defaults. See ________PLOGHELP * ______STATIC.

    __________no_clauses
        The predicate has been declared as having no clauses. See
        ________PLOGHELP * __________NO_CLAUSES.

    _______clauses
        The predicate has been declared as having clauses. See
        ________PLOGHELP * _______CLAUSES.

    ________________system_predicate
        The predicate has been declared as a system predicate. See
        ________PLOGHELP * ________________SYSTEM_PREDICATE.

    ______________user_predicate
        The predicate has been declared as a user predicate. See
        ________PLOGHELP * ______________USER_PREDICATE.

    _____spied
        There is a spy-point on the predicate. See ________PLOGHELP * ___SPY.

The order of atoms in the ____Info list is unspecified: you should use
member/2 to determine whether a particular atom occurs in the list.

In addition, if the source file in which the predicate was defined is
known, the ____Info list will contain a term of the form:

    file = File

where ____File is the source file pathname as an atom.

As an example, suppose the predicate last/2 is initially undefined:

    ?- predicate_info(last/2, Info).
    Info = [undefined] ?

Compiling the definition:

    last([X], X).
    last([_|Xs], X) :-
        last(Xs, X).

in the default environment, with no prior declarations, gives:

    ?- predicate_info(last/2, Info).
    Info = [user_predicate, static, clauses] ?

This shows the defaults applied by the compiler. Executing the
declaration:

    :- no_clauses last/2.

will strip the clauses from the definition (leaving only the compiled
code) and give:

    ?- predicate_info(last/2, Info).
    Info = [user_predicate, static, no_clauses] ?

Finally, after placing a spy-point on the predicate:

    :- spy last/2.
    Spypoint placed on last/2

    ?- predicate_info(last/2, Info).
    Info = [user_predicate, static, no_clauses, spied] ?


See also:

________PLOGHELP * __________CURRENT_OP
    Determines whether an atom has been declared as an operator.


--- ______________________________C.all/plog/help/predicate_info
--- _________Copyright __________University __of ______Sussex _____1993. ___All ______rights _________reserved.
