From: Mark Thom Date: Thu, 27 Jan 2022 00:34:36 +0000 (-0700) Subject: use expand_goal directly for existential-qualified goals in all-solutions predicates... X-Git-Tag: v0.9.0^2~40 X-Git-Url: https://git.sagredo.dev/?a=commitdiff_plain;h=142ddcd57ab41cb7ebdbd2924dd84f79314cfe71;p=scryer-prolog.git use expand_goal directly for existential-qualified goals in all-solutions predicates (#1246) --- diff --git a/src/lib/builtins.pl b/src/lib/builtins.pl index a060a69c..6a70423e 100644 --- a/src/lib/builtins.pl +++ b/src/lib/builtins.pl @@ -698,15 +698,15 @@ rightmost_power(Term, FinalTerm, Xs) :- findall_with_existential(Template, Goal, PairedSolutions, Witnesses0, Witnesses) :- ( nonvar(Goal), - ( Goal = _ ^ _ - ; Goal = _ : (_ ^ _) - ) -> - rightmost_power(Goal, Goal1, ExistentialVars0), + loader:strip_module(Goal, M, Goal1), + ( Goal1 = _ ^ _ ) -> + rightmost_power(Goal1, Goal2, ExistentialVars0), term_variables(ExistentialVars0, ExistentialVars), sort(Witnesses0, Witnesses1), sort(ExistentialVars, ExistentialVars1), set_difference(Witnesses1, ExistentialVars1, Witnesses), - findall(Witnesses-Template, Goal1, PairedSolutions) + expand_goal(M:Goal2, M, Goal3), + findall(Witnesses-Template, Goal3, PairedSolutions) ; Witnesses = Witnesses0, findall(Witnesses-Template, Goal, PairedSolutions) ).