From a460e84c570c97d86b40b7878e493c5fd5d121d5 Mon Sep 17 00:00:00 2001 From: Mark Thom Date: Sun, 17 Feb 2019 12:23:25 -0700 Subject: [PATCH] sort attribute goals before deduplicating them linearly --- src/prolog/lib/reif.pl | 2 +- src/prolog/machine/attributed_variables.rs | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/prolog/lib/reif.pl b/src/prolog/lib/reif.pl index ad12fcc6..77af1893 100644 --- a/src/prolog/lib/reif.pl +++ b/src/prolog/lib/reif.pl @@ -5,7 +5,7 @@ :- use_module(library(control), [(\=)/2]). :- use_module(library(dif)). -/* in essence, '$reify_switch'(T, Then_0, Else_0) is semantically this: +/* in essence, '$reify_switch'(T, Then_0, Else_0) is semantically this, ( T == true -> call(Then_0) ; T == false -> call(Else_0) ; nonvar(T) -> throw(error(type_error(boolean, T), _)) diff --git a/src/prolog/machine/attributed_variables.rs b/src/prolog/machine/attributed_variables.rs index af776697..5686dd47 100644 --- a/src/prolog/machine/attributed_variables.rs +++ b/src/prolog/machine/attributed_variables.rs @@ -162,6 +162,7 @@ impl MachineState { return; } + attr_goals.sort_unstable_by(|a1, a2| self.compare_term_test(a1, a2)); self.term_dedup(&mut attr_goals); let mut output = PrinterOutputter::new(); -- 2.54.0