small fixes.

This commit is contained in:
Vitor Santos Costa 2011-05-08 23:49:06 +01:00
parent 925b8fec01
commit 72a83eec62
2 changed files with 10 additions and 5 deletions

View File

@ -116,7 +116,7 @@ rule(Head, Body) :-
builtins([]) --> []. builtins([]) --> [].
builtins(G.Gs) --> builtins(G.Gs) -->
builtin(G), !, builtin(G),
builtins(Gs). builtins(Gs).
builtin(Res = Op) --> !, builtin(Res = Op) --> !,
@ -198,8 +198,8 @@ compile_goal(Goal, Goals, Gs, Head) :-
reorder_builtins(DelGoal, DelBLF, DelBLF2), reorder_builtins(DelGoal, DelBLF, DelBLF2),
listtobody(BLF2, Body), listtobody(BLF2, Body),
listtobody(DelBLF2, DelBody), listtobody(DelBLF2, DelBody),
once((assert(meld_program:(run(Goal) :- Body)), assert(meld_program:(run(Goal) :- Body)),
assert(meld_program:(run(deleted(DelGoal)) :- DelBody)))). assert(meld_program:(run(deleted(DelGoal)) :- DelBody)).
% quantified variables should not leave the scope of the forall. % quantified variables should not leave the scope of the forall.
quantified_vars(G,Extern,NG) :- quantified_vars(G,Extern,NG) :-
@ -312,7 +312,8 @@ listtobody([G|GL], (G,Gs)) :-
reorder_builtins(Head, BLF, BLF2) :- reorder_builtins(Head, BLF, BLF2) :-
term_variables(Head, Vs0), term_variables(Head, Vs0),
reorder_term(BLF, Vs0, [], BLF2). sort(Vs0, Vs),
reorder_term(BLF, Vs, [], BLF2).
% 4 arguments % 4 arguments
% list of input goals % list of input goals

View File

@ -117,13 +117,17 @@ min(Skel,_,Goal) :-
sum(Skel,Arg,Goal) :- sum(Skel,Arg,Goal) :-
copy_term(Skel, NGoal), copy_term(Skel, NGoal),
meld_program:Skel, meld_program:Skel, !,
arg(Arg, Skel, A0), arg(Arg, Skel, A0),
delete(Skel), delete(Skel),
arg(Arg, Goal, A), arg(Arg, Goal, A),
AN is A0+A, AN is A0+A,
arg(Arg, NGoal, AN), arg(Arg, NGoal, AN),
push(NGoal). push(NGoal).
sum(_Skel,_Arg,Goal) :-
format('S~w~n',[Goal]),
assert(meld_program:Goal),
fail.
clean(Skel) :- clean(Skel) :-
% format('D~w~n',[Skel]), % format('D~w~n',[Skel]),