Newbie question: testing for lvalue



On 12/31/06, Michel Van den Bergh <michel.vandenbergh at uhasselt.be> wrote:

> What is the best way to check that an expression evaluates to an lvalue?
> I.e. a variable or a subscripted variable?

How about this --

P(e) := symbolp(e) or subvarp(e);

P(a) => true, P(a[1]) => true, P(a[n]) => true, P(a + b) => false

Note also P("foo") => true (because "foo" is a symbol).

Hope this helps,
Robert Dodier