]> Repositorios git - scryer-prolog.git/commitdiff
dif/2: Succeed unconditionally if the arguments are not unifiable.
authorMarkus Triska <[email protected]>
Sat, 22 Aug 2020 15:47:42 +0000 (17:47 +0200)
committerMarkus Triska <[email protected]>
Sat, 22 Aug 2020 15:50:15 +0000 (17:50 +0200)
This addresses one part of #135.

src/lib/dif.pl

index 347e9d13571dbc1268a89ddb53059c2820c2d08e..ad3053ec3b3d1bcf569410b8a8411f642446c21a 100644 (file)
@@ -38,11 +38,14 @@ verify_attributes(Var, Value, Goals) :-
 % Probably the world's worst dif/2 implementation. I'm open to
 % suggestions for improvement.
 
-dif(X, Y) :- X \== Y,
-             (   term_variables(X, XVars), term_variables(Y, YVars),
-                dif_set_variables(XVars, X, Y),
-                dif_set_variables(YVars, X, Y)
-            ).
+dif(X, Y) :-
+    X \== Y,
+    (   X \= Y -> true
+    ;   (   term_variables(X, XVars), term_variables(Y, YVars),
+            dif_set_variables(XVars, X, Y),
+            dif_set_variables(YVars, X, Y)
+        )
+    ).
 
 gather_dif_goals([]) --> [].
 gather_dif_goals([(X \== Y) | Goals]) -->