Handling Undefined Procedures

A predicate in a module is said to be undefined if there are no clauses defining the predicate, and if the predicate has not been declared to be dynamic.

What YAP does when trying to execute undefined predicates can be specified in three different ways:

  • By setting an YAP flag, through the set_prolog_flag//22 or set_prolog_flag//22 built-ins. This solution generalizes the ISO standard by allowing module-specific behavior.

  • By using the unknown//22 built-in (this deprecated solution is compatible with previous releases of YAP).

  • By defining clauses for the hook predicate user:unknown_predicate_handler//33. This solution is compatible with SICStus Prolog.