From: Mark Thom Date: Fri, 6 Dec 2019 14:30:16 +0000 (-0400) Subject: print equations between variables (#228, #252) X-Git-Tag: v0.8.118~36^2~1 X-Git-Url: https://git.sagredo.dev/?a=commitdiff_plain;h=90e1c990e5563f48cf3ddf50153328b7a83dc18d;p=scryer-prolog.git print equations between variables (#228, #252) --- diff --git a/src/prolog/toplevel.pl b/src/prolog/toplevel.pl index 6b3f7711..74df6a6f 100644 --- a/src/prolog/toplevel.pl +++ b/src/prolog/toplevel.pl @@ -144,13 +144,20 @@ ). '$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)