]> Repositorios git - scryer-prolog.git/commitdiff
print equations between variables (#228, #252)
authorMark Thom <[email protected]>
Fri, 6 Dec 2019 14:30:16 +0000 (10:30 -0400)
committerMark Thom <[email protected]>
Fri, 6 Dec 2019 14:30:16 +0000 (10:30 -0400)
src/prolog/toplevel.pl

index 6b3f771125af72bdb6472c19b8b629dfdd3a3bfd..74df6a6f384193732f04ebbed31faa0721c4d19d 100644 (file)
     ).
 '$gather_query_vars'([], []).
 
+'$is_a_different_variable'([Var = Binding | Pairs], Value) :-
+    (  Value == Binding, !
+    ;  '$is_a_different_variable'(Pairs, Value)
+    ).
+
 '$gather_goals'([], VarList, Goals) :-
     '$get_attr_var_queue_beyond'(0, AttrVars),
     '$gather_query_vars'(VarList, QueryVars),
     '$call_attribute_goals'(QueryVars, AttrVars),
     '$fetch_attribute_goals'(Goals).
 '$gather_goals'([Var = Value | Pairs], VarList, Goals) :-
-    (  nonvar(Value) ->
+    (  (  nonvar(Value)
+       ;  '$is_a_different_variable'(Pairs, Value)
+       ) ->
        Goals = [Var = Value | Goals0],
        '$gather_goals'(Pairs, VarList, Goals0)
     ;  '$gather_goals'(Pairs, VarList, Goals)