remove setof/3, bagof/3 non-determinism (#270)
This commit is contained in:
@@ -456,7 +456,10 @@ group_by_variants([V-S|Pairs], [V-Solution|Solutions]) :-
|
|||||||
group_by_variants(Pairs0, Solutions).
|
group_by_variants(Pairs0, Solutions).
|
||||||
group_by_variants([], []).
|
group_by_variants([], []).
|
||||||
|
|
||||||
iterate_variants([V-Solution|GroupSolutions], V, Solution).
|
iterate_variants([V-Solution|GroupSolutions], V, Solution) :-
|
||||||
|
( GroupSolutions == [] -> !
|
||||||
|
; true
|
||||||
|
).
|
||||||
iterate_variants([_|GroupSolutions], Ws, Solution) :-
|
iterate_variants([_|GroupSolutions], Ws, Solution) :-
|
||||||
iterate_variants(GroupSolutions, Ws, Solution).
|
iterate_variants(GroupSolutions, Ws, Solution).
|
||||||
|
|
||||||
@@ -491,7 +494,10 @@ bagof(Template, Goal, Solution) :-
|
|||||||
iterate_variants(GroupedSolutions, Witnesses, Solution).
|
iterate_variants(GroupedSolutions, Witnesses, Solution).
|
||||||
|
|
||||||
iterate_variants_and_sort([V-Solution0|GroupSolutions], V, Solution) :-
|
iterate_variants_and_sort([V-Solution0|GroupSolutions], V, Solution) :-
|
||||||
sort(Solution0, Solution).
|
sort(Solution0, Solution),
|
||||||
|
( GroupSolutions == [] -> !
|
||||||
|
; true
|
||||||
|
).
|
||||||
iterate_variants_and_sort([_|GroupSolutions], Ws, Solution) :-
|
iterate_variants_and_sort([_|GroupSolutions], Ws, Solution) :-
|
||||||
iterate_variants_and_sort(GroupSolutions, Ws, Solution).
|
iterate_variants_and_sort(GroupSolutions, Ws, Solution).
|
||||||
|
|
||||||
@@ -948,7 +954,7 @@ chars_or_vars([C|Cs], PI) :-
|
|||||||
).
|
).
|
||||||
|
|
||||||
can_be_codes_or_vars(Cs, _) :- var(Cs), !.
|
can_be_codes_or_vars(Cs, _) :- var(Cs), !.
|
||||||
can_be_codes_or_vars(Cs, PI) :-
|
can_be_codes_or_vars(Cs, PI) :-
|
||||||
( string(Cs) ->
|
( string(Cs) ->
|
||||||
current_prolog_flag(double_quotes, codes)
|
current_prolog_flag(double_quotes, codes)
|
||||||
; codes_or_vars(Cs, PI)
|
; codes_or_vars(Cs, PI)
|
||||||
|
|||||||
@@ -2207,7 +2207,7 @@ impl MachineState {
|
|||||||
(HeapCellValue::Addr(Addr::PStrLocation(..)),
|
(HeapCellValue::Addr(Addr::PStrLocation(..)),
|
||||||
HeapCellValue::Addr(Addr::Con(Constant::String(..))))
|
HeapCellValue::Addr(Addr::Con(Constant::String(..))))
|
||||||
| (HeapCellValue::Addr(Addr::Con(Constant::String(..))),
|
| (HeapCellValue::Addr(Addr::Con(Constant::String(..))),
|
||||||
HeapCellValue::Addr(Addr::PStrLocation(..)))
|
HeapCellValue::Addr(Addr::PStrLocation(..)))
|
||||||
if self.flags.double_quotes.is_chars() => {
|
if self.flags.double_quotes.is_chars() => {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -3169,7 +3169,8 @@ impl MachineState {
|
|||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(super) fn setup_built_in_call(&mut self, ct: BuiltInClauseType) {
|
pub(super)
|
||||||
|
fn setup_built_in_call(&mut self, ct: BuiltInClauseType) {
|
||||||
self.num_of_args = ct.arity();
|
self.num_of_args = ct.arity();
|
||||||
self.b0 = self.b;
|
self.b0 = self.b;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user