Subject: Q about arguments scoping in function definition
From: Robert Dodier
Date: Wed, 10 Oct 2007 09:02:40 -0600
On 10/10/07, Stavros Macrakis <macrakis at alum.mit.edu> wrote:
> > How about if Maxima never evaluates a function name?
>
> My favorite notation for applying a function value is (fval)(a,b,c).
> Unfortunately, this doesn't work in current Maxima, but instead you
> can write (+fval)(a,b,c).
Hmm, I wonder why (fval)(...) doesn't cause evaluation of fval.
> I would suggest that we implement (fval)(a,b,c) and *recommend* it to
> users, but not change fval(a,b,c) for now.
I'm willing to consider the notation (fval)(...).
> > It appears that Maxima never evaluates array names.
>
> The semantics of Maxima arrays is a mess in many ways, but I think you
> are mistaken that Maxima (5.13) never evaluates array names:
>
> a: [a,b,c]$
Well, this is a list, which is treated differently than arrays and functions ...
> ha[2]: two$ hasharray
> haval: 'h$
> havalval[2] => two
OK, this is more confusing than I thought. Sometimes the
array name is evaluated and sometimes it is not.
ha[2] : two;
haval : 'ha;
haval[2] => two (OK)
haval[3] : three;
ha[3] => ha[3] (shouldn't that be 'three ?)
haval[2] : four;
ha[2] => two (shouldn't that be 'four ?)
:lisp (symbol-plist (mget '$haval 'hashar))
=> (ARRAY #(4 2 1 NIL NIL (((2) . $FOUR)) (((3) . $THREE))))
:lisp (symbol-plist (mget '$ha 'hashar))
=> (ARRAY #(4 1 1 NIL NIL (((2) . $TWO)) NIL))
> But I would prefer the notation (aname)[i,j] here, too.
Yes, that could be workable.
Robert