:- import numbervars/1 from num_vars.

:- table subg_term/1.
subg_term(_X).

% panics w. PDL list at 50000.
:- table ans_term/1.
ans_term(X):- functor(X,f,5000),numbervars(X).

:- table ans_term_v/1.
ans_term_v(X):- functor(X,f,50000).

test:- test_tab_subg_term,fail.
test:- test_tab_ans_term,fail.
test:- test_tab_ans_term,fail.
test.

test_tab_subg_term:- functor(T,f,5000),numbervars(T),subg_term(T),fail.
test_tab_subg_term:- get_residual(subg_term(X),_),functor(X,F,A),writeln(test_subg_term(F/A)).

test_tab_ans_term:- ans_term(_T),write(tabling_done),fail.
test_tab_ans_term:- get_residual(ans_term(X),_),functor(X,F,A),writeln(test_ans_term(F/A)).

test_tab_ans_term_v:- ans_term_v(_T),fail.
test_tab_ans_term_v:- get_residual(ans_term_v(X),_),functor(X,F,A),writeln(test_ans_term(F/A)).

