test(Pred) :- test1(Pred), test2(Pred), test3(Pred).

test1(Pred) :-
	Term =.. [Pred,a,[a,b,c,a],N], call(Term),
	write('freq.de a='), write(N), nl.

test2(Pred) :-
	write('quem ap.1 vez='),
	Term =.. [Pred,A,[a,b,c,a],1], call(Term),
	write(A), nl, fail.
test2(_).

test3(Pred) :-
	write('pares [A,N]='),
	Term =.. [Pred,A,[a,b,c,a],N], call(Term),
	write([A,N]), nl, fail.
test3(_).

