Robert Dodier <robert.dodier at gmail.com> writes:
> matchdeclare (cc, P);
> P(e) := P1(e) or (not atom(e) and op(e) # 'E and every (P, args(e)));
> P1(e) := <stuff which is now the body of lambda in matchdeclare>;
I think it works as you suggested
P(e) := P1(e) or (not atom(e) and op(e) # 'E and every (P, args(e))) $
P1(e) := lfreeof( get ('E, 'listofnonconstants), e) or (not
atom(e) and op(e) = 'E) $
matchdeclare (cc, P) $
matchdeclare (aa, all) $
tellsimpafter (E (aa * cc), cc * E (aa)) $
tellsimpafter (E (cc), cc) $
(%i7) display2d: false $
(%i8) put ('E, '[x, y], 'listofnonconstants) $
(%i9) [E(a), E(x*a), E(x*E(x)), E(f(E(x))), E(f(a)), E(x+a)] $
(%i10) ''%;
(%o10) [a,a*E(x),E(x)^2,f(E(x)),f(a),E(x+a)]