invert_by_lu does not work as expected



Not sure what lexical scope in the Maxima language (call it MaximaL) has to
do with lexical scope in the implementation Lisp, call it MaxLisp (which
was the original issue).

Both MaximaL and MaxLisp use a variety of global variables to control the
behavior of various functions.  Things like $simp, $algebraic, $gcd,
$fpprec, $ratvars, etc.  It is a common idiom to write
block([algebraic:false], ...) or its equivalent in Lisp.  This is ugly and
error-prone, but very convenient, and pretty common.  Of course, you could
always have some way of exempting some variables (declare them "dynamic")
but then you're back to the original problem of lack of referential
transparency.

This is without addressing the question of the interpretation of symbolic
variables.  For example, what is the value of block([x],x)-x?  Is it 0?  Or
is the inner x a different symbolic variable?

            -s

On Tue, Jan 17, 2012 at 16:13, Robert Dodier <robert.dodier at gmail.com>wrote:

> Steve, I'm glad to hear that lexical scope is indeed achievable,
> although I'm dismayed to find it's rather clumsy.
> About macrology, a LET-like macro which guaranteed lexical
> binding seems useful.
>
> The stuff about programming conventions is beside the point;
> either the programming language guarantees lexical binding
> or it doesn't. You will recall we arrived here because
> reasonable people made different assumptions about symbol LB.
>
> I'm in favor of implementing lexical scope in Maxima,
> although there's no need to replicate CL's craziness.
> I suspect most user programs would work the same if function and block
> variables
> obeyed lexical binding, so, while it would be a substantial change,
> the trouble it causes for users would be tractable; no need to dismiss
> lexical binding out of hand.
>
> best
>
> Robert Dodier
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>