[Next]
[Up]
[Previous]
[Contents]
[Index]
Next: External Language Interface with
Up: Tabling
Previous: Example:
  Contents
  Index
A data area, called table area, is used to store tabled calls
and their answers. The following predicate initializes the table area.
initialize_table
Tabled subgoals and answers are accumulated in the table area until the table area is initialized explicitly.
Tabled calls are stored in a hashtable, called subgoal table,
and for each tabled call and its variants, a hashtable, called answer table, is used to store the answers for the call. The bucket
size for the subgoal table is initialized to 9001. To change or access this size, use the following built-in predicate:
subgoal_table_size(SubgoalTableSize)
which sets the size if SubgoalTableSize is an integer and gets the current size if SubgoalTableSize is a variable.
The following two built-ins are used to clean up table entries:
- table_remove0: remove complete tabled subgoals that have no solution.
- table_remove(Subgoal): remove complete subgoals that match the given pattern Subgoal.
The following two built-ins are provided for fetching answers from the table.
- table_find_one(Call):
If there is a subgoal in the subgoal table that is a variant of Call and that has answers, then Call is unified with the first answer. The built-in fails if there is no variant subgoal in the table or there is no answer available.
- table_find_all(Call,Answers):
Answers is a list of answers of the subgoals that are subsumed by Call. For example, the table_find_one(_,Answers) fetches all the answers in the table since any subgoal is subsumed by the anonymous variable.
[Next]
[Up]
[Previous]
[Contents]
[Index]
Next: External Language Interface with
Up: Tabling
Previous: Example:
  Contents
  Index
Neng-Fa Zhou ()
2007-06-05