remvalue, was: Strange plot2d behaviour



There are 2 issues:  what should remvalue do, and what does Michel really
intend here.

1. It seems to me that the purpose of remvalue is to try to reduce the
Maxima state to one in which no user variables have global values. Thus
running remvalue() on a locally bound symbol is beside the point. A change
to the documentation of remvalue might "fix" this. 

Merely setting s, as in s:false; may be all that you intend,  or perhaps it
is enough to do  s:'s.

I think the "system value" has to do with trying to do  remvalue(false);
after s has been removed, but maybe not...

2. If you want to have a symbol that no one else can utter, someone
suggested using gensyms.
That is,  r:?gensym();  r::3  /* note :: not : */ ;   r;  ev(r);  Or using
's, as above, may solve your problem. 

Usually it is a good idea to put bug reports in some context, so that others
can know what you are trying to accomplish. Using functions like remvalue in
unintended ways may reveal behavior that is complicated to explain, but not
important. (The analog in common lisp may be "unintern" whose meaning can be
looked up in an common lisp manual.)

RJF

> -----Original Message-----
> From: maxima-bounces at math.utexas.edu 
> [mailto:maxima-bounces at math.utexas.edu] On Behalf Of Robert Dodier
> Sent: Monday, January 01, 2007 9:06 AM
> To: Michel Van den Bergh
> Cc: maxima at math.utexas.edu
> Subject: remvalue, was: Strange plot2d behaviour
> 
> On 1/1/07, Michel Van den Bergh 
> <michel.vandenbergh at uhasselt.be> wrote:
> 
> > (%i1) g(s):=block([s__],s__:s,remvalue(s),s__)$
> > (%i2) g(2);
> > (%o2)                                  2
> > (%i3) plot2d(g,[t,1,2]);
> > Warning: Illegal `remvalue' attempt:
> > s
> > Warning: Illegal `remvalue' attempt:
> > s
> 
> Well, the strangeness is in REMVALUE (src/suprv1.lisp),
> which assumes that bound symbols must be on the Maxima values list
> (the list which comprises variables that have been assigned values).
> A Maxima function argument is bound but it is not on the values list,
> so REMVALUE complains.
> 
> REMVALUE could be modified to unbind symbols even if they
> are not on the values list; maybe that would be better.
> 
> If you just want to work with the symbol s verbatim, maybe you can
> just write 's to prevent evaluation.
> 
> A Maxima trivia item -- function arguments don't appear on the
> values list, but local variables in block do appear.
> e.g. block([aa, bb, cc], print(values)) => prints out [aa, bb, cc].
> 
> All the best,
> Robert Dodier
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>