]> Repositorios git - scryer-prolog.git/commitdiff
use expand_goal directly for existential-qualified goals in all-solutions predicates...
authorMark Thom <[email protected]>
Thu, 27 Jan 2022 00:34:36 +0000 (17:34 -0700)
committerMark Thom <[email protected]>
Thu, 27 Jan 2022 00:34:36 +0000 (17:34 -0700)
src/lib/builtins.pl

index a060a69c016d807426400ce404813a5fd0209eff..6a70423e4453208e6e7d2935834c4363e5f13312 100644 (file)
@@ -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)
     ).