From eec588f488df37442548800be24004aa04d3f3d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADtor=20Santos=20Costa?= Date: Mon, 13 Dec 2010 21:33:43 +0000 Subject: [PATCH] distribute goal_Expansion over comma --- pl/modules.yap | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/pl/modules.yap b/pl/modules.yap index a3ed65774..2fde70cb7 100644 --- a/pl/modules.yap +++ b/pl/modules.yap @@ -309,6 +309,8 @@ 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) :- @@ -316,6 +318,25 @@ 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'(G, CurMod, GI) :- ( '$pred_exists'(goal_expansion(G,GI), CurMod),