tabling.pl -- Tabled execution (SLG WAM)
This library handled tabled execution of predicates using the characteristics if the SLG WAM. The required suspension is realised using delimited continuations implemented by reset/3 and shift/1. The table space and work lists are part of the SWI-Prolog core.
- table(+PredicateIndicators)
- Prepare the given PredicateIndicators for tabling. Can only be
used as a directive. The example below prepares the predicate
edge/2 and the non-terminal statement//1 for tabled execution.
:- table edge/2, statement//1.
In addition to using predicate indicators, a predicate can be declared for mode directed tabling using a term where each argument declares the intended mode. For example:
:- table connection(_,_,min).
Mode directed tabling is discussed in the general introduction section about tabling.
- start_tabling(+Variant, +Implementation)
- Execute Implementation using tabling. This predicate should not be called directly. The table/1 directive causes a predicate to be translated into a renamed implementation and a wrapper that involves this predicate.
- abolish_all_tables
- Remove all tables. This is normally used to free up the space or recompute the result after predicates on which the result for some tabled predicates depend.
- abolish_table_subgoals(:Subgoal) is det
- Abolish all tables that unify with SubGoal.
- current_table(:Variant, -Trie) is nondet
- True when Trie is the answer table for Variant.
- prolog:rename_predicate(:Head0, :Head) is semidet[multifile]
- Hook into term_expansion for post processing renaming of the generated predicate.
- sandbox:safe_directive(+Directive) is semidet[multifile]
- Allow tabling directives that affect locally defined predicates.