proposal: subscripted local variables



Hello,

At present local variables created within block or within a function
(named or unnamed) must be symbols, not subscripted variables.
I'm pretty sure it would be straightforward to relax that restriction.
Maxima already allows global variables which are subscripted;
why not local variables as well.

An example use: you have an expression with some free variables
which are subscripted, and you want to construct a function which
takes those variables as arguments.

After some tinkering with the lambda & dynamic binding stuff, I get
the following:

expr : FOO (a, b, c[1], d[2], e[u]);
listofvars (expr);
  => [a,b,c[1],d[2],e[u]]
F : buildq ([L : listofvars (expr), expr], lambda (L, expr));
  => lambda([a,b,c[1],d[2],e[u]],FOO(a,b,c[1],d[2],e[u]))
(a:1, b:2, c[1]:1, d:[1, 2, 3], e[u]:4);
F (%i, x + y, 1/%pi, 1 - %e, 2);
  => FOO(%i,y+x,1/%pi,1-%e,2)
[a, b, c[1], d[2], e[u]];
  => [1,2,1,2,4]

The code I have is incomplete, but I think it is all just a matter of
bookkeeping.
If this seems like a good idea, I'll spend some more time on it.

Comments?

Robert