Previous Next Contents

6.8  Predicate information

6.8.1  current_predicate/1

Templates

current_predicate(?predicate_indicator)
Description

current_predicate(Pred) succeeds if there exists a predicate indicator of a defined procedure that unifies with Pred. All user defined procedures are found, whether static or dynamic. Internal system procedures whose name begins with '$' are not found. A user-defined procedure is found even when it has no clauses. A user-defined procedure is not found if it has been abolished. To conform to the ISO reference, built-in predicates are not found except if the strict_iso Prolog flag is switched off (section 6.22.1). This predicate is re-executable on backtracking.

Errors


Pred is neither a variable nor a predicate indicator    type_error(predicate_indicator, Pred)

Pred is a term Name/Arity and Arity is neither a variable nor an integer    type_error(integer, Arity)

Pred is a term Name/Arity and Name is neither a variable nor an atom    type_error(atom, Name)

Pred is a term Name/Arity and Arity is an integer < 0    domain_error(not_less_than_zero, Arity)

Pred is a term Name/Arity and Arity is an integer > max_arity flag (section 6.22.1)    representation_error(max_arity)


Portability

ISO predicate.

6.8.2  predicate_property/2

Templates

predicate_property(?predicate_indicator, ?predicate_property)
Description

predicate_property(Pred, Property) succeeds if current_predicate(Pred) succeeds (section 6.8.1) and if Property unifies with one of the properties of the procedure. This predicate is re-executable on backtracking.

Predicate properties:

Errors


Pred is neither a variable nor a predicate indicator    type_error(predicate_indicator, Pred)

Pred is a term Name/Arity and Arity is neither a variable nor an integer    type_error(integer, Arity)

Pred is a term Name/Arity and Name is neither a variable nor an atom    type_error(atom, Name)

Pred is a term Name/Arity and Arity is an integer < 0    domain_error(not_less_than_zero, Arity)

Pred is a term Name/Arity and Arity is an integer > max_arity flag (section 6.22.1)    representation_error(max_arity)

Property is neither a variable nor a predicate property term    domain_error(predicate_property, Property)

Property = prolog_file(File) and File is neither a variable nor an atom    type_error(atom, File)

Property = prolog_line(Line) and Line is neither a variable nor an integer    type_error(integer, Line)


Portability

GNU Prolog predicate.




Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved.

More about the copyright
Previous Next Contents