Question: Function depending on a variable list of paramters

In the same vein as my last question, I need to bang out function symbols depending on a variable list of parameters, and refer to them later. I'm currently doing this:

PW > FunGen := symb -> PDETools[declare](symb(w1, w2, x1, y1), symb);
F > F0 := [b, seq(cat(r, i), i = 1 .. k), seq(cat(s, i), i = 1 .. k)];
                          [b, r1, s1]
PW > map(FunGen, F0);
          b(w1, w2, x1, y1) will now be displayed as b
         r1(w1, w2, x1, y1) will now be displayed as r1
         s1(w1, w2, x1, y1) will now be displayed as s1
F > dx := i -> 'eval(cat(dx, i))';
dy := i -> eval(cat(dy, i));
r := i -> parse(cat(r, i, "(w1,w2,x1,y1)"));
s := i-> parse(cat(s, i, "(w1,w2,x1,y1)"));
epsilon := i -> cat(epsilon, i);
F > bb := parse(cat(b, "(w1,w2,x1,y1)"));

I generate the function aliases for r,s,b depending on w1,w2,x1,y1, and refer to them later with 'r(i)', 's(i)' and bb. In general however, the number of x's and y's is variable (depending on k).

What I would like to do is something like

F > args := w1, w2, seq([x || i, y || i][], i = 1 .. k);
                         w1, w2, x1, y1
PW > FunGen := symb -> PDETools[declare](symb(args), symb)
r := i -> (cat(r, i)(args)
...

This does now however work, even though cat(r, i)(args) on a standalone line does indeed produce ri(w1, w2, x1, y1) and correctly parses to r1, etc.

Please Wait...