Did you know ... Search Documentation:
tabling.pl -- Tabled execution (SLG WAM)
PublicShow source

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.

- Benoit Desouter, Jan Wielemaker and Fabrizio Riguzzi
Source table :PredicateIndicators
Prepare the given PredicateIndicators for tabling. This predicate is normally used as a directive, but SWI-Prolog also allows runtime conversion of non-tabled predicates to tabled predicates by calling table/1. 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 untable(M:PIList) is det
Remove tabling for the predicates in PIList. This can be used to undo the effect of table/1 at runtime. In addition to removing the tabling instrumentation this also removes possibly associated tables using abolish_table_subgoals/1.
PIList- is a comma-list that is compatible ith table/1.
Source tnot(:Goal)
Tabled negation.
Source $wfs_call(:Goal, :Delays)
Call Goal and provide WFS delayed goals as a conjunction in Delays. This predicate is teh internal version of call_delays/2 from library(wfs).
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.

Abolishes both local and shared tables. Possibly incomplete tables are marked for destruction upon completion.

Source abolish_table_subgoals(:Subgoal) is det
Abolish all tables that unify with SubGoal.
To be done
- : SubGoal must be callable. Should we allow for more general patterns?
Source abolish_module_tables(+Module) is det
Abolish all tables for predicates associated with the given module.
Source abolish_nonincremental_tables is det
Abolish all tables that are not related to incremental predicates.
Source abolish_nonincremental_tables(+Options)
Allow for skipping incomplete tables while abolishing.
To be done
- Mark tables for destruction such that they are abolished when completed.
Source current_table(:Variant, -Trie) is nondet
True when Trie is the answer table for Variant.
Source $wrap_incremental(:Head) is det
Wrap an incremental dynamic predicate to be added to the IDG.
Source $unwrap_incremental(:Head) is det
Remove dynamic predicate incremenal forwarding, reset the possible abstract property and remove possible tables.
Source undefined
Expresses the value bottom from the well founded semantics.

Undocumented predicates

The following predicates are exported, but not or incorrectly documented.

Source $moded_wrap_tabled(Arg1, Arg2, Arg3, Arg4)
Source $wrap_tabled(Arg1, Arg2)
Source start_subsumptive_tabling(Arg1, Arg2, Arg3)
Source start_tabling(Arg1, Arg2, Arg3)
Source start_tabling(Arg1, Arg2, Arg3, Arg4, Arg5)