Dynamic predicates may be tabled just as static predicates, as the following exercise shows.
?- table(dyn_path/2).
and
?- load_dyn(dyn_examples).
Try the queries to path/2 of the previous examples. Note that
it is important to dynamically load dyn_examples.P --
otherwise the code in the file will be compiled without knowledge of
the tabling declaration.In general, as long as the directive table/1 is executed before asserting (or dynamically loading) the predicates referred to in the directive, any dynamic predicate can be tabled.