indirect subscripted variable assignment



Let's take advantage of the fact that arraysetapply is undocumented to give
it a better name!  In particular, why "apply"?  Perhaps because it takes a
list of subscripts?  But arraymake (not a great name either...) also takes
a list of subscripts....

                -s

On Tue, Jul 3, 2012 at 1:43 AM, Robert Dodier <robert.dodier at gmail.com>wrote:

> On 2012-07-02, J?rome Laurens <jerome.laurens at u-bourgogne.fr> wrote:
>
> > given a[1] and b[1], I want a function f such that f(a) will set a[1]
> > to some value whereas f(b) will set b[1] to the same value.
>
> Use the undocumented (sorry, I guess) function arraysetapply here.
>
> (%i1) f(x):= arraysetapply (x, [1], 12345);
> (%o1)                f(x) := arraysetapply(x, [1], 12345)
> (%i2) f(a);
> (%o2)                                12345
> (%i3) a[1];
> (%o3)                                12345
> (%i4) f(b);
> (%o4)                                12345
> (%i5) b[1];
> (%o5)                                12345
>
> HTH
>
> Robert Dodier
>
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>