From 9b4f17521bb8a7d96c09d540880679298ce6f08e Mon Sep 17 00:00:00 2001 From: Peter Mikkelsen Date: Tue, 13 Jul 2021 18:35:24 +0000 Subject: When binding two variables to eachother, always bind to the one with the lowest clause number --- eval.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/eval.c b/eval.c index e490eb6..b300d11 100644 --- a/eval.c +++ b/eval.c @@ -194,6 +194,11 @@ unify(Term *a, Term *b, Binding **bindings) left = right; right = tmp; } + if(left->tag == VariableTerm && right->tag == VariableTerm && right->clausenr > left->clausenr){ + Term *tmp = left; + left = right; + right = tmp; + } if(runestrcmp(left->text, L"_") == 0) continue; /* _ doesn't introduce a new binding */ -- cgit v1.2.3