scryer-prolog
scryer-prolog copied to clipboard
multifile and discontiguous interaction
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.