/* count1(Atom,List,Number) if Number is the number of terms in List that
unify with Atom */
count1( _,[],0).
count1( A,[ A|T],N) :- !,
 count1( A,T,N1),
 N is N1+1.
count1( A,[ _|L],N) :-
 count1( A,L,N).

/* count2(Atom,List,Number) if Number is the number of atoms in List that
are identical to Atom */
count2( _,[],0).
count2(A,[ B|T],N) :-
 atom( B), A = B, !,  % B is atom A?
 count2( A,T,N1),
 N is N1+1
 ;
 count2( A,T,N).

