version 1.1, 2005/03/30 05:10:40 |
version 1.2, 2005/03/30 10:54:02 |
|
|
/* $OpenXM$ */ |
/* $OpenXM: OpenXM/src/asir-contrib/testing/rewriting.rr,v 1.1 2005/03/30 05:10:40 takayama Exp $ */ |
|
|
/* |
/* |
OpenXM$BHG$N(B Risa/Asir $B$G<B9T$N$3$H(B. OpenXM $BHG$N4X?t$rMQ$$$k$?$a(B. |
OpenXM$BHG$N(B Risa/Asir $B$G<B9T$N$3$H(B. OpenXM $BHG$N4X?t$rMQ$$$k$?$a(B. |
Line 147 def makeBind(F,P) { |
|
Line 147 def makeBind(F,P) { |
|
Tree $B$NCf$rI}M%@hC5:w$G8!:w$7$F(B $BCV$-49$($k(B. |
Tree $B$NCf$rI}M%@hC5:w$G8!:w$7$F(B $BCV$-49$($k(B. |
$BI}M%@hC5:w$J$N$G(B, $BF1$8(B rule $B$K%^%C%A$9$k$b$N$,F~$l;R$K$J$C$?>l9g(B, |
$BI}M%@hC5:w$J$N$G(B, $BF1$8(B rule $B$K%^%C%A$9$k$b$N$,F~$l;R$K$J$C$?>l9g(B, |
$BFbB&$OCV$-49$($i$l$J$$(B. |
$BFbB&$OCV$-49$($i$l$J$$(B. |
Todo: $B?<$5M%@hC5:w(B. |
$B?<$5M%@hC5:w(B --> $B$H$j$"$($:$O(B action $B4X?t$NCf$G:F5"E*$K8F$Y$P?<$5M%@h$H$J$k(B. |
Todo: $B=q$-49$($,$*$3$C$?$+$N%U%i%0(B. |
Todo: $B=q$-49$($,$*$3$C$?$+$N%U%i%0(B. |
*/ |
*/ |
def rp(F,P,Q) { |
def rp(F,P,Q) { |
|
|
return R; |
return R; |
} |
} |
|
|
/* $BI}M%@hC5:w$N>l9g(B, $B$3$l$O(B simplify $B$G$-$:(B. */ |
extern Rule_test2$ |
|
Rule_test2=[quote(sin(pn("x")*@pi)),["r_sin_int2","x"]]$ |
|
|
def test2() { |
def test2() { |
|
/* $BI}M%@hC5:w$N>l9g(B, $B$3$l$O(B simplify $B$G$-$:(B. */ |
Rule1=[quote(sin(pn("x")*@pi)),["r_sin_int","x"]]; |
Rule1=[quote(sin(pn("x")*@pi)),["r_sin_int","x"]]; |
R0 = quote(1+sin(sin(2*@pi)*@pi)*sin(@pi/2)); |
R0 = quote(1+sin(sin(2*@pi)*@pi)*sin(@pi/2)); |
print(print_input_form(R0)); |
print(print_input_form(R0)); |
R=apply_rule1(R0,Rule1[0],Rule1[1]); |
R=apply_rule1(R0,Rule1[0],Rule1[1]); |
return R; |
print(print_input_form(R)); |
|
print("-----------------------"); |
|
/* $B$7$+$7<!$N$h$&$K=q$/$H?<$5M%@h$G=q$1$k(B */ |
|
R0 = quote(1+sin(sin(2*@pi)*@pi)*sin(@pi/2)); |
|
print(print_input_form(R0)); |
|
R=apply_rule1(R0,Rule_test2[0],Rule_test2[1]); |
|
print(print_input_form(R)); |
|
} |
|
|
|
/* $B1&5,B'4X?t(B. sin($B@0?t(B*@pi) $B$r(B 0 $B$K(B. $B?<$5M%@hMQ(B */ |
|
def r_sin_int2(X) { |
|
/* apply_rule1 $B$r:F5"E*$K$h$V(B. $B$3$NJ}K!$G9=J82r@O$b$+$1$k(B. */ |
|
X = apply_rule1(X,Rule_test2[0],Rule_test2[1]); |
|
Y = quotetolist(X); |
|
R = "quote(sin("+quote_input_form_quote_list(Y)+"*@pi))"; |
|
print(R); |
|
R = eval_str(R); |
|
if (Y[0] == "internal") { |
|
Z = eval_str(rtostr(Y[1])); |
|
}else{ |
|
return quotetolist(R); |
|
} |
|
if (type(Z) == 0) return quotetolist(quote(0)); |
|
if ((type(Z) == 1) && (ntype(Z) == 0)) return quotetolist(quote(0)); |
|
return quotetolist(R); |
} |
} |
|
|
|
|