# Hiding shift/reset on tracing

**URL:** <https://swi-prolog.discourse.group/t/hiding-shift-reset-on-tracing/2998>\
**Category:** Help!\
**Tags:** how-to\
**Created:** [October 3, 2020, 5:09am UTC](https://swi-prolog.discourse.group/t/hiding-shift-reset-on-tracing/2998 "2020-10-03T05:09:38Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kuniaki.mukai](https://avatars.discourse-cdn.com/v4/letter/k/c67d28/32.png) [@kuniaki.mukai](https://swi-prolog.discourse.group/u/kuniaki.mukai)\
**Post date:** [October 3, 2020, 5:09am UTC](https://swi-prolog.discourse.group/t/hiding-shift-reset-on-tracing/2998/1 "2020-10-03T05:09:38Z")

</div>

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.

```prolog
% ?- 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

```prolog
%@ % 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.

```

```prolog
:- 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).

```

---

<div class="post-metadata">

**Author:** ![EricGT](https://avatars.discourse-cdn.com/v4/letter/e/f1d935/32.png) [@EricGT](https://swi-prolog.discourse.group/u/EricGT)\
**Post date:** [October 3, 2020, 2:57pm UTC](https://swi-prolog.discourse.group/t/hiding-shift-reset-on-tracing/2998/2 "2020-10-03T14:57:02Z")

</div>

So I read your question this morning and it stuck in my mind with no idea of how to solve it.

Then in searching GitHub for code examples for another problem found [this](https://github.com/TeamSPoon/wam_common_lisp/blob/d46b2d5b9194330dfa7550fa633f55e87d6cf54d/prolog/wam_cl/setup_lm_packs.pl#L21-L30) which uses `$hide`. Obviously the next question is what does `$hide` do, well it is not documented so searching the GitHub SWI-Prolog source code one finds [this](https://github.com/SWI-Prolog/swipl-devel/blob/6ab186fbb94500434a729b352633ea7a910d73f2/boot/init.pl#L112-L131).

> Specify that the predicate cannot be seen in the debugger.

HTH

---

<div class="post-metadata">

**Author:** ![kuniaki.mukai](https://avatars.discourse-cdn.com/v4/letter/k/c67d28/32.png) [@kuniaki.mukai](https://swi-prolog.discourse.group/u/kuniaki.mukai)\
**Post date:** [October 3, 2020, 4:10pm UTC](https://swi-prolog.discourse.group/t/hiding-shift-reset-on-tracing/2998/3 "2020-10-03T16:10:57Z")

</div>

Thank you for taking time to make search on GitHub. As system  
predicates such like =/2, call/N are not allowed to have spy  
points, it is rather strange for me why the system predicates  
shift/reset pause even when no spy points are specified. It  
would be convenient for users on debugging to have a control over  
for not to see such lenghty but useless infomation shown by  
shift/reset.

Kuniaki Mukai
