]> Repositorios git - scryer-prolog.git/commitdiff
deduplicate but do not sort anonymous variables in toplevel (#1196)
authorMark Thom <[email protected]>
Sat, 15 Jan 2022 18:03:41 +0000 (11:03 -0700)
committerMark Thom <[email protected]>
Sun, 16 Jan 2022 02:24:22 +0000 (19:24 -0700)
src/machine/system_calls.rs
src/toplevel.pl

index 6163a4679cfa33452704c3876df79e975bbe4e9d..67611cc563db473176e982bed705d79c6bc39d44 100644 (file)
@@ -555,7 +555,7 @@ impl MachineState {
         let outcome = heap_loc_as_cell!(
             iter_to_heap_list(
                 &mut self.heap,
-                seen_set.into_iter().rev(),
+                seen_set.into_iter(),
             )
         );
 
index b72e0ed1b0e611756d0f14e59bd34c4956815ab6..27783c45ec49c8c1ee49ee054d111a3592198ace 100644 (file)
@@ -292,7 +292,7 @@ write_eqs_and_read_input(B, VarList) :-
     % one layer of depth added for (=/2) functor
     maplist(\Term^Vs^term_variables_under_max_depth(Term, 22, Vs), Equations, EquationVars),
     append([AttrGoalVars | EquationVars], Vars1),
-    sort(Vars1, Vars2),
+    term_variables(Vars1, Vars2), % deduplicate vars of Vars1 but preserve their order.
     charsio:extend_var_list(Vars2, VarList, NewVarList0, fabricated),
     (   bb_get('$first_answer', true) ->
         write('   '),