trealla-prolog / trealla

A compact, efficient Prolog interpreter written in plain-old C.
MIT License
274 stars 13 forks source link

dif/2 : Printing choked off #500

Closed flexoron closed 5 months ago

flexoron commented 9 months ago

v2.38.8

$ tpl
?- dif(W,V),V=[V].
   V = [V], dif:dif(W,[[[_A]]]).
?- dif(V,W),V=[V].
   V = [V], . % half-done
?-
infradig commented 8 months ago

Yes, odd...

?- dif(W,V), V=[V], '$list_attributed'(Vs). V = [V], Vs = [W], dif:dif(W,[[[_A]]]).

?- dif(V,W), V=[V], '$list_attributed'(Vs). V = [V], Vs = [W], .

More specifically...

?- dif(V,W),V=[V], '$list_attributed'(Vs), get_atts(W, As). V = [V], Vs = [W], As = [dif([[[[As]]]\==W])], . ?-

infradig commented 8 months ago

Might be related, stumbled on it while looking into dump_attvars/0 failing here...

?- V=[V], copy_term([V],W), acyclic_term(W). V = [V], W = [[_A]]. % should fail ?- V=[V], copy_term(f(V),W), acyclic_term(W). V = [V], W = f([_A]). % should fail ?-

infradig commented 8 months ago

Fix copy_term/2 & friends...

?- V=[V], copy_term(f(V),W), acyclic_term(W). false. ?- V=[V], copy_term(f(V),W). V = [V], W = f([W]).

but makes no difference to the problem with dif/2 residuals.

flexoron commented 5 months ago

v2.52.16

?- dif(V,W),V=[V].
   V = [V], dif:dif([[[[[V]]]]],W). % finished