use select/3 in gather_equations for detecting whether variables are distinct.
This commit is contained in:
@@ -1143,7 +1143,8 @@ impl ListingCompiler {
|
|||||||
result
|
result
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn gather_items(
|
pub(crate)
|
||||||
|
fn gather_items(
|
||||||
&mut self,
|
&mut self,
|
||||||
wam: &mut Machine,
|
wam: &mut Machine,
|
||||||
src: &mut ParsingStream<Stream>,
|
src: &mut ParsingStream<Stream>,
|
||||||
|
|||||||
@@ -235,7 +235,7 @@ write_eqs_and_read_input(B, VarList) :-
|
|||||||
append([Vars0, AttrVars, AttrGoalVars], Vars),
|
append([Vars0, AttrVars, AttrGoalVars], Vars),
|
||||||
charsio:extend_var_list(Vars, VarList, NewVarList, fabricated),
|
charsio:extend_var_list(Vars, VarList, NewVarList, fabricated),
|
||||||
'$get_b_value'(B0),
|
'$get_b_value'(B0),
|
||||||
gather_equations(NewVarList, Goals, AttrGoals),
|
gather_equations(NewVarList, NewVarList, Goals, AttrGoals),
|
||||||
( bb_get('$first_answer', true) ->
|
( bb_get('$first_answer', true) ->
|
||||||
write(' '),
|
write(' '),
|
||||||
bb_put('$first_answer', false)
|
bb_put('$first_answer', false)
|
||||||
@@ -294,17 +294,18 @@ gather_query_vars([], []).
|
|||||||
|
|
||||||
is_a_different_variable([_ = Binding | Pairs], Value) :-
|
is_a_different_variable([_ = Binding | Pairs], Value) :-
|
||||||
( Value == Binding, !
|
( Value == Binding, !
|
||||||
; is_a_different_variable(Pairs, Value)
|
; is_a_different_variable(Pairs, Var)
|
||||||
).
|
).
|
||||||
|
|
||||||
gather_equations([], Goals, Goals).
|
gather_equations([], MasterList, Goals, Goals).
|
||||||
gather_equations([Var = Value | Pairs], Goals, Goals1) :-
|
gather_equations([Var = Value | Pairs], MasterList, Goals, Goals1) :-
|
||||||
|
select((Var = _), MasterList, MasterPairs),
|
||||||
( ( nonvar(Value)
|
( ( nonvar(Value)
|
||||||
; is_a_different_variable(Pairs, Value)
|
; is_a_different_variable(MasterPairs, Value)
|
||||||
) ->
|
) ->
|
||||||
Goals = [Var = Value | Goals0],
|
Goals = [Var = Value | Goals0],
|
||||||
gather_equations(Pairs, Goals0, Goals1)
|
gather_equations(Pairs, MasterList, Goals0, Goals1)
|
||||||
; gather_equations(Pairs, Goals, Goals1)
|
; gather_equations(Pairs, MasterList, Goals, Goals1)
|
||||||
).
|
).
|
||||||
|
|
||||||
print_exception(E) :-
|
print_exception(E) :-
|
||||||
|
|||||||
Reference in New Issue
Block a user