[Maxima] Newbie Question: Are arguments in a function definition bound when function is called?
fateman at cs.berkeley.edu
Wed Aug 26 10:32:40 CDT 2009
Robert Dodier wrote:
> On 8/26/09, Stavros Macrakis <macrakis at alum.mit.edu> wrote:
>> Assignment (q: ...) and binding set the value slot; function
>> definition (q(x) := ...) sets the function slot. When evaluating the
>> function call q(...), Maxima first checks the function slot, and only
>> if there is no function value does it check the value slot.
> For the record, I know we've discussed it before, it seems like
> the existing function evaluation scheme is more complex than
> it needs to be. As I'm sure you know, it would be simpler to
> always look at the value slot or never. Today I'm inclined to
> say "always" but it seems to change depending on the weather.
> It occurs to me (and I would expect that it's been discussed
> in the Lisp-1 vs Lisp-2 literature) that we could have multiple slots
> but allow at most one of them to hold something.
> Robert Dodier
> Maxima mailing list
> Maxima at math.utexas.edu
There are many items associated with symbols. The symbol cos has
properties that pertain
to simplification, derivatives, integrals, perhaps inequalities,
If someone uses cos as a local variable or a bound argument, do you
want all of this
It is not that it would make a programming language unusable. After all,
dialect of lisp does that. But requiring
to be written as g(f,x):= apply(f,[x])
or perhaps (f)(x)
is pretty easy, and is apparent by looking at the code.
The other direction is pretty hard, and would, I think, require
(implementing lexical scope). Some programs would run just the same.
Some would be very
subtly different. Some would be substantially broken, and some programs
and ev would become (I fear) terribly confusing unless the users were
about functions, functional arguments, closures, and scope.
Just off the top of my head though..
More information about the Maxima