All predicatesShow sourcetabling.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.

author
- Benoit Desouter
Source 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.

Source 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.
Compatibility
- This interface may change or disappear without notice from future versions.
Source delim(+Wrapper, +Worker, +WorkList)[private]
Source delim(+Wrapper, +WrapperNoModes, +Worker, +WorkList)[private]
Call/resume Worker
Source update(+Wrapper, +A1, +A2, -A3) is det[private]
Update the aggregated value for an answer. Wrapper is the tabled goal, A1 is the aggregated value so far, A2 is the new answer and A3 should be unified with the new aggregated value. The new aggregate is ignored if it is the same as the old one.
Source completion[private]
Wakeup suspended goals until no new answers are generated.
Source 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.
Errors
- permission_error(abolish, table, all) if tabling is in progress.
Source abolish_table_subgoals(:Subgoal) is det
Abolish all tables that unify with SubGoal.
Source current_table(:Variant, -Trie) is nondet
True when Trie is the answer table for Variant.
Source extract_modes(+ModeSpec, +Head, -Variant, -Modes, -ModedAnswer) is det[private]
Split Head into its variant and term that matches the moded arguments.
Arguments:
ModedAnswer- is a term that captures that value of all moded arguments of an answer. If there is only one, this is the value itself. If there are multiple, this is a term s(A1,A2,...)
Source separate_args(+ModeSpecArgs, +HeadArgs, -NoModesArgs, -Modes, -ModeArgs) is det[private]
Split the arguments in those that need to be part of the variant identity (NoModesArgs) and those that are aggregated (ModeArgs).
Arguments:
Args- seems a copy of ModeArgs, why?
Source updater_clauses(+Modes, +Head, -Clauses)[private]
Generates a clause to update the aggregated state. Modes is a list of predicate names we apply to the state.
Source first(+S0, +S1, -S) is det[private]
Source last(+S0, +S1, -S) is det[private]
Source min(+S0, +S1, -S) is det[private]
Source max(+S0, +S1, -S) is det[private]
Source sum(+S0, +S1, -S) is det[private]
Implement YAP tabling modes.
Source prolog:rename_predicate(:Head0, :Head) is semidet[multifile]
Hook into term_expansion for post processing renaming of the generated predicate.
Source sandbox:safe_directive(+Directive) is semidet[multifile]
Allow tabling directives that affect locally defined predicates.
Source delim(+Wrapper, +Worker, +WorkList)[private]
Source delim(+Wrapper, +WrapperNoModes, +Worker, +WorkList)[private]
Call/resume Worker
Source first(+S0, +S1, -S) is det[private]
Source last(+S0, +S1, -S) is det[private]
Source min(+S0, +S1, -S) is det[private]
Source max(+S0, +S1, -S) is det[private]
Source sum(+S0, +S1, -S) is det[private]
Implement YAP tabling modes.
Source first(+S0, +S1, -S) is det[private]
Source last(+S0, +S1, -S) is det[private]
Source min(+S0, +S1, -S) is det[private]
Source max(+S0, +S1, -S) is det[private]
Source sum(+S0, +S1, -S) is det[private]
Implement YAP tabling modes.
Source first(+S0, +S1, -S) is det[private]
Source last(+S0, +S1, -S) is det[private]
Source min(+S0, +S1, -S) is det[private]
Source max(+S0, +S1, -S) is det[private]
Source sum(+S0, +S1, -S) is det[private]
Implement YAP tabling modes.
Source first(+S0, +S1, -S) is det[private]
Source last(+S0, +S1, -S) is det[private]
Source min(+S0, +S1, -S) is det[private]
Source max(+S0, +S1, -S) is det[private]
Source sum(+S0, +S1, -S) is det[private]
Implement YAP tabling modes.