I am still somehow working on ZDD which is based on
term_hash/functor/setarg/shift/reset.
Shift/reset are convenient to run prolog
query hyding state on ZDD like this, where zdd/1 is a small predicate defined below.
% ?- zdd((X<<pow([a,b,c,d]), zdd_dump, card(X, C))).
%@ 2 = t(d,1,1)
%@ 3 = t(c,2,2)
%@ 4 = t(b,3,3)
%@ 5 = t(a,4,4)
%@ X = 5,
% ?- zdd((X<<[a,b,c,d], zdd_dump, card(X, C))).
%@ 2 = t(d,0,1)
%@ 3 = t(c,0,2)
%@ 4 = t(b,0,3)
%@ 5 = t(a,0,4)
%@ X = 5,
%@ C = 1.
Is there a way to skip shift/reset on tracing ?
Although shift/reset are useful, but, on debugging,
usually I need not see information on shift/reset. So.
I want to skip shift/reset on tracing. However it seems
no way to skip them even when typing ālā for leashing.
Here is an example on such tracing. Thank you for help.
Kuniaki
%@ % Spy point on zdd:zdd/1
%@ % Spy point on zdd:zdd/3
% ?- zdd(cofact(I, t(a, 1, 0))).
%@ ^* Call: (10) zdd:zdd(zdd:cofact(_10866, t(a, 1, 0))) ? creep
%@ Call: (11) zdd_array:init_state(_11696) ? skip
%@ Exit: (11) zdd_array:init_state(..) ? creep
%@ ^ Call: (11) context_module(_11984) ? skip
%@ ^ Exit: (11) context_module(zdd) ? creep
%@ * Call: (11) zdd:zdd(zdd:cofact(_10866, t(a, 1, 0)), .., zdd) ? creep
%@ * Call: (12) zdd:zdd(cofact(_10866, t(a, 1, 0)), .., zdd) ? creep
%@ ^ Call: (13) reset(zdd:cofact(_10866, t(a, 1, 0)), _12176, _12178) ? creep
%@ Call: (14) zdd:cofact(_10866, t(a, 1, 0)) ? creep
%@ Call: (15) shift(cofact(_10866, t(a, 1, 0))) ? creep
%@ Call: (13) var(cofact(_10866, t(a, 1, 0))) ? creep
%@ Fail: (13) var(cofact(_10866, t(a, 1, 0))) ? creep
%@ * Redo: (12) zdd:zdd(cofact(_10866, t(a, 1, 0)), .., zdd) ? creep
%@ ^ Call: (13) call(zdd:cofact(_10866, t(a, 1, 0)), ..) ? creep
%@ Call: (14) zdd:cofact(_10866, t(a, 1, 0), ..) ? creep
%@ Call: (15) var(_10866) ? creep
%@ Exit: (15) var(_10866) ? creep
%@ Call: (15) _10866=1 ? creep
%@ Exit: (15) 1=1 ? creep
%@ Exit: (14) zdd:cofact(1, t(a, 1, 0), ..) ? creep
%@ ^ Exit: (13) call(zdd:cofact(1, t(a, 1, 0)), ..) ? creep
%@ * Call: (13) zdd:zdd(cont(..), .., zdd) ? creep
%@ ^ Call: (14) reset(zdd:cont(..), _12892, _12894) ? creep
%@ ^ Exit: (14) reset(zdd:cont(..), _12892, 0) ? creep
%@ Call: (14) var(_12892) ? creep
%@ Exit: (14) var(_12892) ? creep
%@ Call: (14) true ? creep
%@ Exit: (14) true ? creep
%@ * Call: (14) zdd:zdd(0, .., zdd) ? creep
%@ * Exit: (14) zdd:zdd(0, .., zdd) ? creep
%@ * Exit: (13) zdd:zdd(cont(..), .., zdd) ? creep
%@ * Exit: (12) zdd:zdd(cofact(1, t(a, 1, 0)), .., zdd) ? creep
%@ * Exit: (11) zdd:zdd(zdd:cofact(1, t(a, 1, 0)), .., zdd) ? creep
%@ ^* Exit: (10) zdd:zdd(zdd:cofact(1, t(a, 1, 0))) ? creep
%@ I = 1.
:- meta_predicate zdd(:).
zdd(E):- init_state(S), context_module(M), zdd(E, S, M).
%
zdd((A,B), S, M):-!, zdd(A, S, M), zdd(B, S, M).
zdd(X<<E, S, _):-!, zdd_eval(E, X, S).
zdd(M:G, S, _):-!, zdd(G, S, M).
zdd(0, _, _):-!.
zdd(true, _, _):-!.
zdd({G}, _, _):-!, call(G).
zdd((A;B), S, M):-!, (zdd(A, S, M); zdd(B, S, M)).
zdd((A->B), S, M):-!, (zdd(A, S, M)->zdd(B, S, M)).
zdd(Cont, S, M):- reset(M:Cont, Ball, Cont0),
( var(Ball) -> true
; call(Ball, S)
),
zdd(Cont0, S, M).