diff --git a/pl/modules.yap b/pl/modules.yap index 2fde70cb7..150c8ffe0 100644 --- a/pl/modules.yap +++ b/pl/modules.yap @@ -309,8 +309,6 @@ module(N) :- expand_goal(G, G) :- var(G), !. -expand_goal(G, M:NG) :- - '$do_expand'(G, M, NG), !. expand_goal(M:G, M:NG) :- '$do_expand'(G, M, NG), !. expand_goal(G, NG) :- @@ -318,25 +316,8 @@ expand_goal(G, NG) :- '$do_expand'(G, M, NG), !. expand_goal(G, G). -'$do_expand'((G1,G2), CurMod, (GI1,GI2)) :- !, - '$do_expand'(G1, CurMod, GI1), - '$do_expand'(G2, CurMod, GI2). -'$do_expand'((G1;G2), CurMod, (GI1;GI2)) :- !, - '$do_expand'(G1, CurMod, GI1), - '$do_expand'(G2, CurMod, GI2). -'$do_expand'((G1*->G2), CurMod, (GI1*->GI2)) :- !, - '$do_expand'(G1, CurMod, GI1), - '$do_expand'(G2, CurMod, GI2). -'$do_expand'((G1|G2), CurMod, (GI1|GI2)) :- !, - '$do_expand'(G1, CurMod, GI1), - '$do_expand'(G2, CurMod, GI2). -'$do_expand'((G1->G2), CurMod, (GI1->GI2)) :- !, - '$do_expand'(G1, CurMod, GI1), - '$do_expand'(G2, CurMod, GI2). -'$do_expand'(\+G1, CurMod, \+GI1) :- !, - '$do_expand'(G1, CurMod, GI1). -'$do_expand'(not(G1), CurMod, not(GI1)) :- !, - '$do_expand'(G1, CurMod, GI1). +'$do_expand'(M:G, CurMod, M:GI) :- !, + '$do_expand'(G, M, GI). '$do_expand'(G, CurMod, GI) :- ( '$pred_exists'(goal_expansion(G,GI), CurMod), @@ -353,7 +334,26 @@ expand_goal(G, G). true ; user:goal_expansion(G, GI) - ). + ), !. +'$do_expand'((G1,G2), CurMod, (GI1,GI2)) :- + '$do_expand'(G1, CurMod, GI1), + '$do_expand'(G2, CurMod, GI2). +'$do_expand'((G1;G2), CurMod, (GI1;GI2)) :- + '$do_expand'(G1, CurMod, GI1), + '$do_expand'(G2, CurMod, GI2). +'$do_expand'((G1*->G2), CurMod, (GI1*->GI2)) :- + '$do_expand'(G1, CurMod, GI1), + '$do_expand'(G2, CurMod, GI2). +'$do_expand'((G1|G2), CurMod, (GI1|GI2)) :- + '$do_expand'(G1, CurMod, GI1), + '$do_expand'(G2, CurMod, GI2). +'$do_expand'((G1->G2), CurMod, (GI1->GI2)) :- + '$do_expand'(G1, CurMod, GI1), + '$do_expand'(G2, CurMod, GI2). +'$do_expand'(\+G1, CurMod, \+GI1) :- + '$do_expand'(G1, CurMod, GI1). +'$do_expand'(not(G1), CurMod, not(GI1)) :- + '$do_expand'(G1, CurMod, GI1). % args are: % goal to expand diff --git a/pl/preds.yap b/pl/preds.yap index 875dc1b81..77815f9e7 100644 --- a/pl/preds.yap +++ b/pl/preds.yap @@ -212,7 +212,8 @@ assertz_static(C) :- '$head_and_body'(C,H,B), '$assertat_d'(last,H,B,C0,Mod,_). '$assertz_dynamic'(X,C,C0,Mod) :- - '$head_and_body'(C,H,B), functor(H,N,A), + '$head_and_body'(C,H,B), + functor(H,N,A), ('$check_if_reconsulted'(N,A) -> true ;