symbolic subscript of literal list or matrix



On 7/24/07, Robert Dodier <robert.dodier at gmail.com> wrote:
> On 7/24/07, Barton Willis <willisb at unk.edu> wrote:
>
> > >> > I would like to change it so that a subscript expression is returned.
> > >> > E.g. a : [1, 2, 3]; a[k] => a[k]
> >
> > What problem does this solve?
>
> I bumped into it in the following example, which I don't consider far-fetched.
>
> 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. It is
just happenstance that your approach works in this case: L[k] is
re-evaluated in a context where L has a value. That is not true in
general.

> > Might this scheme just make errors happen later instead of sooner?
> Well, I don't feel much obligation to protect the user from himself.
> You know the old saying: preventing stupidity prevents cleverness as well.

Robert, we have had this discussion before many times.  Repeating this
silly slogan (which seems irrelevant to this case anyway) proves
nothing.  I think all of us who have long experience with Maxima (and
many other programming systems for that matter) believe that errors
should be caught and reported at the earliest possible point -- but
not earlier.  I really don't know where you get the peculiar idea that
delaying error detection or giving bogus results is better than
detecting errors.

            -s