Subject: Vector Identities, Redux and more questions
From: Richard Fateman
Date: Thu, 14 Sep 2006 11:47:30 -0700
As I pointed out previously, there is the additional consideration
that the function/predicate names are dynamically bound, not just
the symbol names.
35 years ago, when this code was written (by me), the potential for
confusion was recognized, though perhaps only dimly. There are
a number of binding times.
1. evaluation of matchdeclare
2. evaluation of defrule (or tellsimp...)
3. application of a rule (or simplifier)
4. [probably not supported in maxima] compilation of a rule into
lisp/assembler.
These come up in so many little questions ..
r1:firstrule$
a:AA$
defrule(r1, f(a),a+1); are we defining r1 or firstrule? is it
f(AA)->AA+1, or
f(a)->a+1, or f(a)->AA+1?
a:BB$
is the rule unchanged?
etc etc etc.
The simplest solution seems to be to never re-bind or re-set global
names, which
is of course hard to enforce, but makes all these issues moot: x
evaluates to x,
for all x involved.
RJF
Robert Dodier wrote:
>On 9/14/06, Neilen Marais <nmarais at sun.ac.za> wrote:
>
>
>
>>My only worry is that if we start having globally defined matchdeclare
>>properties we should probably define all the matchdeclare variables right
>>at the start of vect, also some naming convention is also called for.
>>
>>
>
>Calling local (a, b, c, ...) within block is enough to prevent matchdeclare
>properties from propagating out of the vect script.
>We can put each rule in a separate block; that way we can localize
>changes to rules. (If all declarations are at the top, changing a rule
>means changing code in two places, which invites errors.)
>
>One feature of the rule-matching code is that matchdeclare symbols
>appear as dynamically-bound variables in the constructed rule function.
>This has the potential to trigger the confusing behavior that comes
>from name collisions of dynamic variables. That could probably be
>avoided by matchdeclare-ing gensyms, or just choosing uncommon
>names (simpler but not guaranteed to avoid collision).
>
>FWIW
>Robert
>_______________________________________________
>Maxima mailing list
>Maxima at math.utexas.edu
>http://www.math.utexas.edu/mailman/listinfo/maxima
>
>