I have this code:
res([],M,M).
res([[A,B]|G],inM,M) :-
dfs(A, [[A,B]|G], [], [], Out),
processResponse(Out,inM,M1),
dfs(B, [[A,B]|G], [], [], Out2),
processResponse(Out2,M1,M2),
res(G,M2,M).
If I run res([],[],M)
, on the interpreter, it works fine and returns M = []
.
If I run res([[a,b]],[],M)
, it fails. I tried looking at the trace and it fails immediately on res
without even trying dfs
or any of the other rules. If I write the rules directly on the interpreter, with the same input, they work fine.
I'm using SWI Prolog. Why does this happen? What should I change to make this work?