[Maxima] Newbie question: testing for lvalue (correction)
Michel Van den Bergh
michel.vandenbergh at uhasselt.be
Mon Jan 1 05:17:52 CST 2007
Actually your function is not quite correct. P((a+b)) returns true
whereas it should
return false (one can argue that (a+b) has no meaning if a,b are unbound,
but maxima does not throw an error).
The following seems to work always
P(e) := (symbolp(e) or (subvarp(e) and P(part(e,0)))) and not ?mstringp(e);
Robert Dodier wrote:
> On 12/31/06, Michel Van den Bergh <michel.vandenbergh at uhasselt.be> wrote:
>> Hmm, a string is not an lvalue (something that can appear on the
>> left hand side of an assignment). "describe" claims that there is
>> a function "stringp" but on my version of maxima stringp appears
>> not to do anything. Is this a bug?
> It turns out stringp is defined in an add-on package (namely stringproc).
> Probably it should move into the main source code.
> Be that as it may, the function ?mstringp has the desired effect.
> So we can update the test function to
> P(e) := (symbolp(e) or subvarp(e)) and not ?mstringp(e);
> Sorry, I could have included that to begin with. Hope this helps.
More information about the Maxima