scryer-prolog icon indicating copy to clipboard operation
scryer-prolog copied to clipboard

multifile and discontiguous interaction

Open bakaq opened this issue 9 months ago • 0 comments

If you mark a predicate as both multifile and discontiguous multiple times (as you would need to do in the case of generated code), the order in which you do so matters for some reason:

:- multifile(a/1).
:- discontiguous(a/1).
a(1).

:- multifile(a/1).
:- discontiguous(a/1).
a(2).

:- discontiguous(b/1).
:- multifile(b/1).
b(1).

:- discontiguous(b/1).
:- multifile(b/1).
b(2).
?- a(A).
   A = 2, unexpected.
?- b(B).
   B = 1
;  B = 2.

bakaq avatar Apr 15 '25 08:04 bakaq