Hello Alec, happy new year!
Have you had any chance to look at the problem again? I've tried to write the new ApplyRule myself, but I haven't been able to. You really seem to have a lot more knowledge about programming in MAPLE than I do, so I think that my best hope would be for you to do it. I really don't want to be annoying, but the possibility to do this kind of pattern based transforms is very important for the kind of things I use MAPLE for. If it is not much to ask, I would appreciate it very much if you could do this last procedure, as well as add manually the type "sequence" as you said.
Thanks in advance,
Mad Math

The new "Subs" and "&/" procedures are really great. Now I can do a lot of things I always wanted to be able to do with MAPLE. And with a very simple notation! Thanks a lot.
However, there are a couple of situations which these procedures seem not to be able to handle the way, for example, FORM does it. So, if it is not too much to ask, I would appreciate it if you could do this last couple of adjustments. One of them is a small one, the other is a bit more important.
Let's start with the bigger one: In the "eps(a,b,c)*eps(a,b,d)" expample, it would be good if the pattern could be matched regardless on whether there are other factors in the expression. For example, in FORM you can do
Local F = A*eps(a,b,c)*B*C*eps(a,b,d)*W,U;
id eps(i?,j?, k?)*eps(i?,j?,l?) = d(k,l);
where, A,B,C,W,U are just some symbols, and you get
F = A*B*C*W*U*d(k,l),
as one would like.
-------
The smaller change I mentioned is the following: it would be nice if besides being able to do, for example
(K(a,c)*K(b,c)) &/ (K(i_,k_)&*K(j_,k_) = s(i,j))
s(a,b)
one could also do the same when having indices, i.e.
(K[a,c]*K[b,c]) &/ (K[i_,k_]&*K[j_,k_] = s(i,j))
or even
(K[a][c]*K[b][c]) &/ (K[i_][k_]&*K[j_][k_] = s(i,j))
and get the same result.
One last question: is there any good reason why there isn't an expression sequence type in MAPLE? If not, that might be my real product suggestion, i.e. to include the type of an expression sequence (and also the type of an expression sequence that includes the possibility of having zero or more expressions, similar to x__ and x___ in MATHEMATICA).
Once again, thank you very much for your help.

Thank you very much for your quick reply. The procedure you wrote is quite nice, and it really allows one to do many of the things I was talking about. However, it still doesn't seem to be general enough. There are two important situations where I've been not able to apply "Subs". These are:
1.-) Cases where you have a parameter sequence. For example, in MATHEMATICA you can do
f[a,b,c] /. f[x__] -> p[x,x,x]
and you get
p[a,b,c,a,b,c,a,b,c]
As I said in my fisrt post, x__ (two underscores) means any sequence to be named x. In FORM this can be done by putting an interrogation sign behind x, for example, one could write the following code,
Symbols x,y;
CFunctions f,g;
Local F = f(x,y,z) + f;
id f(?a) = g(0,?a,0,?a,0);
Print;
end:
and after you compile, you get
F = g(0,x,y,z,0,x,y,z,0) + g(0,0,0)
Since MAPLE's help manual says explicitly that "there is no expression sequence type in MAPLE", I don't see how this could be implemented. Simply writting
Subs(f(a::anything)=g(0,a,0,a,0),f(x,y,z));
Doesn't work.
2.-) It would be nice to be able to handle more complicated patterns, e.g. patterns not restricted to single objects. For example, in FORM, x*y^n?*f(i,g?(i)) is a valid pattern. You can do stuff like this
Local F2 = eps(a,b,c) * eps(a,b,d)
id eps(i?,j?,k?) * eps(i?,j?,l?) = delta(k,l);
and you get
F2 = delta(c,d);
As you see, this is very useful for contracting indices in products of expressions (this is one of the reasons why FORM is used so often in high energy physics, where calculations involving the algebra of Lorentz indices are commonplace). If I try to do the same using "Subs",
Subs(eps(i::anything,j::anything,k::anything)*
eps(i::anything,j::anything,l::anything)=delta(k,l),
eps(a,b,c)*eps(a,b,d));
it won't do the job.
Is there any way to get these cases to work?