Ah ha! Yes, that can be made to work. I knew about that variable but
didn't think it through properly. Here's what I need (this is in
Maxima 5.9.1, hence the upper case names):
(%i1) let([a,b],rule1);
(%o1) a --> b
(%i2) let([c,d],rule2);
(%o2) c --> d
(%i3) dorules(x,newrules) := block([originalpackage,y],
originalpackage : CURRENT_LET_RULE_PACKAGE,
CURRENT_LET_RULE_PACKAGE : newrules,
y : letsimp(x),
CURRENT_LET_RULE_PACKAGE : originalpackage,
y)$
(%i4) dorules(a+b+c+d,rule1);
(%o4) d + c + 2 b
(%i5) dorules(a+b+c+d,rule2);
(%o5) 2 d + b + a
(%i6) letsimp(a+b+c+d);
(%o6) d + c + b + a
--- Barton Willis wrote:
> Try making an assignment to 'current_let_rule_package.'
>
> (%i1) dorules(x) := letsimp(x);
> (%o1) dorules(x):=LETSIMP(x)
> (%i2) let([a,b],rule1);
> (%o2) a-->b
> (%i3) let([c,d],rule2);
> (%o3) c-->d
> (%i4) current_let_rule_package : rule1;
> (%o4) rule1
> (%i5) dorules(a+b+c+d);
> (%o5) d+c+2*b
> (%i6) current_let_rule_package : rule2;
> (%o6) rule2
> (%i7) dorules(a+b+c+d);
> (%o7) 2*d+b+a
>
> Barton
__________________________________
Do you Yahoo!?
Yahoo! Mail - Find what you need with new enhanced search.
http://info.mail.yahoo.com/mail_250