symbolic subscript of literal list or matrix



On 7/24/07, Stavros Macrakis <macrakis at alum.mit.edu> wrote:

> > L : [1, 2, 3, 4, 5];
> > 'sum (L[k], k, 1, 5);
> > =>
> > Subscript must be an integer:
> > g15913
>
> This example works as well (I would claim better, but...) with
> [1,2,3,4,5][k] being the value of L[k] on the first evaluation.

On considering this, I agree it works better.

> I really don't know where you get the peculiar idea that
> delaying error detection or giving bogus results is better than
> detecting errors.

The issue is really consistency. To the extent that Maxima is
consistent, the user can extrapolate from past examples.
In the case at hand, Maxima evaluates L[k] to something
reasonable when k is known and L is unknown, and this is
consistent with Maxima's generally lazy evaluation scheme.
But at present, L[k] triggers an error when L is known and k
is unknown. I just want to make Maxima handle these cases
alike.

best
Robert