next up previous contents index
Next: Exercises Up: Definite Programs Previous: Subsumption-Based Tabled Evaluation   Contents   Index


Tabling Directives and Declarations

Predicates can be declared tabled in a variety of ways. A common form is the compiler directive

:- table p1/n1,..., pk/nk.

where pi is a predicate symbol and ni is an integer representing the arity of pi. This directive is normally added to a file containing the predicate(s) to be tabled, a consultation of which recompiles the predicates to employ tabling. Often it is tedious to decide which predicates must be tabled. To address this, XSB can automatically table predicates in files. The declaration auto_table chooses predicates to table to assist in termination, while suppl_table chooses predicates to table to optimize data-oriented queries. Both are explained in Section 3.8.2.

As mentioned in Section 5.2.1, the default tabling strategy used by XSB is variant-based. However, subsumption-based tabling can be made the default by giving XSB the -S option at invocation (refer to Section 3.5). More versatile constructs are provided by XSB so that the tabling method can be selected on a per predicate basis. Use of either directive use_variant_tabling/1 or use_subsumptive_tabling/1, described in Section 6.13.1, ensures that a tabled predicate is evaluated using the desired strategy regardless of the default tabling strategy.



Subsections
next up previous contents index
Next: Exercises Up: Definite Programs Previous: Subsumption-Based Tabled Evaluation   Contents   Index
Luis Fernando P. de Castro 2003-06-27