updated eamconsult, but still supporting only skip_while_var.
Next we plan to support other bluitins through eam and-or-tree controls. Example: var(X) must be transformed into wait_till_bound(X), var(X) that will fail if X is bound or waits till is leftmost in the and-or-tree before continuning... git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1588 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
parent
5179cb7d2b
commit
794f7d1ce7
32
pl/eam.yap
32
pl/eam.yap
@ -16,18 +16,26 @@
|
|||||||
* *
|
* *
|
||||||
*************************************************************************/
|
*************************************************************************/
|
||||||
|
|
||||||
'$_eamtrans'((A,B),(C,D)):- !, '$_eamtrans'(A,C),'$_eamtrans'(B,D).
|
eamtrans(A,A):- var(A),!.
|
||||||
'$_eamtrans'((X is Y) ,(skip_while_var(Vars), X is Y )):- !, '$variables_in_term'(Y,[],Vars).
|
eamtrans((A,B),(C,D)):- !, eamtrans(A,C),eamtrans(B,D).
|
||||||
'$_eamtrans'((X =\= Y),(skip_while_var(Vars), X =\= Y )):- !, '$variables_in_term'(X + Y,[],Vars).
|
eamtrans((X is Y) ,(skip_while_var(Vars), X is Y )):- !, '$variables_in_term'(Y,[],Vars).
|
||||||
'$_eamtrans'((X =\= Y),(skip_while_var(Vars), X =:= Y )):- !, '$variables_in_term'(X + Y,[],Vars).
|
eamtrans((X =\= Y),(skip_while_var(Vars), X =\= Y )):- !, '$variables_in_term'(X + Y,[],Vars).
|
||||||
'$_eamtrans'((X >= Y) ,(skip_while_var(Vars), X >= Y )):- !, '$variables_in_term'(X + Y,[],Vars).
|
eamtrans((X =:= Y),(skip_while_var(Vars), X =:= Y )):- !, '$variables_in_term'(X + Y,[],Vars).
|
||||||
'$_eamtrans'((X > Y) ,(skip_while_var(Vars), X > Y )):- !, '$variables_in_term'(X + Y,[],Vars).
|
eamtrans((X >= Y) ,(skip_while_var(Vars), X >= Y )):- !, '$variables_in_term'(X + Y,[],Vars).
|
||||||
'$_eamtrans'((X < Y) ,(skip_while_var(Vars), X < Y )):- !, '$variables_in_term'(X + Y,[],Vars).
|
eamtrans((X > Y) ,(skip_while_var(Vars), X > Y )):- !, '$variables_in_term'(X + Y,[],Vars).
|
||||||
'$_eamtrans'((X =< Y) ,(skip_while_var(Vars), X =< Y )):- !, '$variables_in_term'(X + Y,[],Vars).
|
eamtrans((X < Y) ,(skip_while_var(Vars), X < Y )):- !, '$variables_in_term'(X + Y,[],Vars).
|
||||||
'$_eamtrans'(B,B).
|
eamtrans((X =< Y) ,(skip_while_var(Vars), X =< Y )):- !, '$variables_in_term'(X + Y,[],Vars).
|
||||||
|
eamtrans((X @>= Y) ,(skip_while_var(Vars), X @>= Y )):- !, '$variables_in_term'(X + Y,[],Vars).
|
||||||
|
eamtrans((X @> Y) ,(skip_while_var(Vars), X @> Y )):- !, '$variables_in_term'(X + Y,[],Vars).
|
||||||
|
eamtrans((X @< Y) ,(skip_while_var(Vars), X @< Y )):- !, '$variables_in_term'(X + Y,[],Vars).
|
||||||
|
eamtrans((X @=< Y) ,(skip_while_var(Vars), X @=< Y )):- !, '$variables_in_term'(X + Y,[],Vars).
|
||||||
|
|
||||||
|
eamtrans((X \= Y) ,(skip_while_var(Vars), X \= Y )):- !, '$variables_in_term'(X + Y,[],Vars).
|
||||||
|
eamtrans((X \== Y),(skip_while_var(Vars), X \== Y )):- !, '$variables_in_term'(X + Y,[],Vars).
|
||||||
|
|
||||||
|
eamtrans(B,B).
|
||||||
|
|
||||||
eamconsult(File):- eam, eam, %fails if eam is disable
|
eamconsult(File):- eam, eam, %fails if eam is disable
|
||||||
assert((term_expansion((A :- B),(A :- C)):- '$_eamtrans'(B,C))),
|
assert((user:term_expansion((A :- B),(A :- C)):- eamtrans(B,C))),
|
||||||
eam, ( consult(File) ; true), eam,
|
eam, ( consult(File) ; true), eam,
|
||||||
retract((term_expansion((A :- B),(A :- C)):- '$_eamtrans'(B,C))).
|
abolish(user:term_expansion,2).
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user