[Up] [Contents] [Index] [Summary]

5.6.6.1 Predicate references

This section discusses the functions used to communicate about predicates. Though a Prolog predicate may defined or not, redefined, etc., a Prolog predicate has a handle that is not destroyed, nor moved. This handle is known by the type predicate_t.

predicate_t PL_pred(functor_t f, module_t m)
Return a handle to a predicate for the specified name/arity in the given module. This function always succeeds, creating a handle for an undefined predicate if no handle was available.

predicate_t PL_predicate(const char *name, int arity, const char* module)
Same a PL_pred(), but provides a more convenient interface to the C-programmer.

void PL_predicate_info(predicate_t p, atom_t *n, int *a, module_t *m)
Return information on the predicate p. The name is stored over n, the arity over a, while m receives the definition module. Note that the latter need not be the same as specified with PL_predicate(). If the predicate was imported into the module given to PL_predicate(), this function will return the module where the predicate was defined.