|
From: Stavros M. <mac...@gm...> - 2026-01-09 17:40:55
|
On Thu, Jan 8, 2026 at 6:56 PM Robert Dodier <rob...@gm...>
wrote:
> On Thu, Jan 8, 2026 at 3:18 PM Stavros Macrakis <mac...@gm...>
> wrote:
>
> > As Fateman points out, no common programming languages support
> subscripted formal variables, for all the good reasons you give.
>
> That's a pretty weak argument, isn't it? There's already all kinds of
> stuff in Maxima that doesn't exist in other languages; that's kind of
> the point of having different languages.
>
You gave the reasons in your mail. Some more examples:
Does *i:3$ f(x[i]):=...* define *f(x[i])* or *f(x[3])*? I don't think it
can define *f(x[3])*, because then how would the body of the definition
"know" the value of *i *at the time it is called? Even if we had lexical
scope, what would *block([i], i:3,* *f(x[i]):=..., i:4, f(x[i]), ...) *do?
Does *f(x[i]):=block([i:3], x[i])* return the value of the formal *x[i]*?
Or *x[3]*?
What does *f(x[2]):=sum(x[i],i,1,3) *return?
etc. Basically, it complicates the semantics for no purpose that has been
articulated yet.
-s
There may be other reasons against non-symbols as arguments, but
> simple popularity or lack of it isn't one of them.
>
> > If it's just the name that is wanted, users can use other conventions if
> their variables have conventional names, e.g., phi_x, phi_y, phi_z.
>
> Maxima already allows nonatomic expressions to be used as variables in
> various contexts, which makes it an unpleasant surprise that it
> doesn't extend to formal arguments.
>
> Robert
>
|