tabling_mode/3

tabling_mode(+ P,? Mode)*

Sets or reads the default tabling mode for a tabled predicate P (or a list of predicates P1,..., Pn or [ P1,..., Pn]). The list of Mode options includes:

  • batched

Defines that, by default, batched scheduling is the scheduling strategy to be used to evaluated calls to predicate P.

  • local

Defines that, by default, local scheduling is the scheduling strategy to be used to evaluated calls to predicate P.

  • exec_answers

Defines that, by default, when a call to predicate P is already evaluated (completed), answers are obtained by executing compiled WAM-like code directly from the trie data structure. This reduces the loading time when backtracking, but the order in which answers are obtained is undefined.

  • load_answers

Defines that, by default, when a call to predicate P is already evaluated (completed), answers are obtained (as a consumer) by loading them from the trie data structure. This guarantees that answers are obtained in the same order as they were found. Somewhat less efficient but creates less choice-points.

The default tabling mode for a new tabled predicate is batched and exec_answers. To set the tabling mode for all predicates at once you can use the set_prolog_flag//22 predicate as described next.