1:- module(pac_test, []). 2:- use_module(util(math)). 3 4term_expansion --> pac:expand_pac. 5 6% ?- test. 7test:- sample(S, A), 8 format("\t~w ==> ~w.\n", [S, A]), 9 fail. 10test:- writeln("test done."). 11 12sample('math:nCr(100, 50, A)', A):- math:nCr(100, 50, A). 13sample(Q, Sum):- 14 Q = 'Sum=sum(0), for( 1..100, pred(Sum, [I]:- ( arg(1, Sum, S), Si is S+I, setarg(1, Sum, Si))))', 15 Sum=sum(0), 16 for( ..(1, 100), pred(Sum, [I]:- ( arg(1, Sum, S), Si is S+I, setarg(1, Sum, Si))))