shithub: pprolog

Download patch

ref: 9b4f17521bb8a7d96c09d540880679298ce6f08e
parent: a40a18fc0181b2b0c59a20dcd89bee7b38d63e40
author: Peter Mikkelsen <peter@pmikkelsen.com>
date: Tue Jul 13 14:35:24 EDT 2021

When binding two variables to eachother, always bind to the one with the lowest clause number

--- a/eval.c
+++ b/eval.c
@@ -194,6 +194,11 @@
 				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 */