Assuming pack pac 1.9.6 is installed by `pack_install/2`

under `~/.local/share/swi-prolog`

, query log below on counting family of sets expressed in zdd terms should be reproduced.

Nothing particular has been added to zdd library of mine for one year in my slow life, but only recently I am realizing usefulness swipl command line options (thanks to @jan), and this is first-step exercise to use it. As next exercise, I have in mind to try command line version which uses arguments. Advice on this are welcome.

In the below, test file “zdd-eval-count.pl” should be put under appropriate directory,

and the path variable EVALCOUNT to be set in the shell script ‘count-zdd-samples-local’

```
% count-zdd-samples-local
#(a)=1
#((a+b)*(a+c))=4
#((a+b)*(c+d))=4
#(a*b*c*a*b)=1
#(a*b+c)=2
#(a+b-(c+d))=2
#((a+b)/a)=1
#((a+b)//a)=1
#((a*c+b)//a)=1
#(*(numlist(1,5)))=1
#(*([1,2,3]))=1
#(+[0,1,2]* +[0,1,2])=6
#(+[1,b,1,1]* +[1,a])=4
#(+[1,2,3,4])=4
#(+numlist(1,100)* +numlist(1,100))=5050
#((a+b)*(a+c)+a*b)=4
#(pow([a,b])-(c+d))=4
#(pow([a,b])//(a+b))=3
#(pow([a,b])/(a+b))=2
#(pow(charlist(a,c)))=1
#(pow(append([1,2],[a,b])))=16
#(pow(subtract([1,2,3],[1,2,a])))=2
#(+atomlist($a(1,10)))=10
#(pow(atomlist($a(1,10))))=1024
```

```
#! /usr/bin/env sh
ROOT="${HOME}/.local/share/swi-prolog/pack/pac/prolog"
PAC="${ROOT}/pac"
SETUPAUX="${ROOT}/setup-aux"
EVALCOUNT=${HOME}/devel/zdd/prolog/zdd/zdd-eval-count
COUNT='zdd_count:count_all'
swipl -q -l ${SETUPAUX} -l ${PAC} -l ${EVALCOUNT} -g ${COUNT} -t halt
```

```
% cat zdd-eval-count.pl
:- module(count_zdd, [count_all/0]).
% ?- count_all.
:- use_module(zdd(zdd)).
count_all:- forall(zdd_term(E), (zmod:zdd, once(count_one(E)))).
%
count_one(E):-
call_with_time_limit(10, (X<< E, card(X, C))),
writeln(#(E)=C).
% examples of zdd terms.
zdd_term( a ).
zdd_term( (a+b)*(a+c)).
zdd_term( (a+b)*(c+d)).
zdd_term( a*b*c*a*b).
zdd_term( a*b + c).
zdd_term( (a+b)-(c+d)).
zdd_term( (a+b)/a).
zdd_term( (a+b)//a).
zdd_term( (a*c+b)//a).
zdd_term( *(numlist(1, 5))).
zdd_term( *([1,2,3])).
zdd_term( +[0, 1, 2]* (+[0, 1, 2])).
zdd_term( +[1,b,1,1] * (+[1,a])).
zdd_term( +[1,2,3,4]).
zdd_term( +(numlist(1,100)) * +(numlist(1,100))).
zdd_term( (a+b)*(a+c) +(a*b)).
zdd_term( pow([a,b])-(c+d)).
zdd_term( pow([a,b])//(a+b)).
zdd_term( pow([a,b])/(a+b)).
zdd_term( pow(charlist(a, c))).
zdd_term( pow(append([1,2],[a, b]))).
zdd_term( pow(subtract([1,2,3], [1,2,a]))).
zdd_term( +(atomlist($a(1,10)))).
zdd_term( pow(atomlist($a(1,10)))).
```