1:- module(math, [boole/2,
2 pairs/2,
3 choices/2, product/3,
4 powerlist/3, powerset/2,
5 string_to_ground_term/2,
6 subst/3,
7 nCr/3, combi/3, combination/4,
8 fun_to_rel/2, rel_to_fun/2, principal_filter/3,
9 all_maps/3,
10 filter/3, inverse_image/3, image/3,
11 bigcap/2,
12 raise_list/3, distribute_cons/3,
13 fact/2, factorial/2, factorial/3,
14 permutations/2
15 ]). 16:- use_module(pac(basic)). 17:- use_module(util(meta2)). 18:- use_module(pac('expand-pac')). 19
20term_expansion --> pac:expand_pac.
21
22:- use_module(pac(op)). 23:- use_module(zdd('zdd-array')). 24
25
26% ?- factorial(54, X).
27% ?- X is (10000)^2. %å
28% ?- X is (10000)^3. %å
29% ?- X is (10000)^4. %京
30% ?- X is (10000)^5. %
31% ?- X is (10000)^6.
32% ?- X is (10)^68. % ç¡é大æ°
33
34% ?- X is (10)^68. % ç¡é大æ°
35% ?- factorial(54, F), X is 10^68, R is rdiv(F, X).
36%@ F = 230843697339241380472092742683027581083278564571807941132288000000000000,
37%@ X = 100000000000000000000000000000000000000000000000000000000000000000000,
38%@ R = 839804478670853788470022637495376624731865611727r363797880709171295166015625000000000000000000 .
39
40% ?- factorial(54, F), X is 10^68, Q is F//X.
41%@ F = 230843697339241380472092742683027581083278564571807941132288000000000000,
42%@ X = 100000000000000000000000000000000000000000000000000000000000000000000,
43%@ Q = 2308 .
44
45% ?- list_to_brace([[]], X).
46% ?- list_to_brace([[],[]], X).
47% ?- list_to_brace([[],[], []], X).
48
49:- bekind(list_to_brace, []).
50[] = `({}).
51[X] = `({})@X.
52[X|Y] = `({})@ (`(',')@X@Y).
53:- ekind. 54
59
60:- bekind(str, []). 61X+Y = :string_concat@X@Y.
62% X+Y = :pred([X, Y, Z]:- string_concat(X, Y, Z))@X@Y. %% OK
63X