Previous Up Next

7.8  Predicate information

7.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 7.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 7.22.1)    representation_error(max_arity)

Portability

ISO predicate.

7.8.2  predicate_property/2

Templates
predicate_property(?predicate_indicator, ?predicate_property)
Description

predicate_property(Pred, Property) succeeds if there exists a predicate indicator of a defined procedure that unifies with Pred and if Property unifies with one of the properties of the procedure. All user defined procedures and built-in predicates are found. Internal system procedures whose name begins with '$' are not found. 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 7.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.


Copyright (C) 1999-2007 Daniel Diaz

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

More about the copyright
Previous Up Next