Maxima error when having strings in terms



Am Samstag, den 20.03.2010, 10:59 -0500 schrieb Barton Willis:
> -----maxima-bounces at math.utexas.edu wrote: -----
> 
> >(%i1) is("x">0);
> >Maxima encountered a Lisp error:
> > "x" is not of type LIST.
> 
> You should, of course, report this as a bug. But I'm not sure that using a string 
> as a variable name is a good practice.
> 
> The function constp (defined in compar.lisp) is the cause of this Lisp error. For
> a string input to constp, floatp, numberp, and symbolp all evalutate to false. After
> that caar is called on the string. Maybe symbolp should be atom or $mapatom. 


I think we could add a line to check in addition for an atom and return
nil. So we do not execute the following code for an atom. I do not know
if we get problems at other places too:

(defun constp (x)
  (cond ((floatp x) 'float)
        ((numberp x) 'numer)
        ((symbolp x) (if (member x '($%pi $%e $%phi $%gamma) :test #'eq)
'symbol))
        ((atom x) nil)
...


> Also maybe (constp '$%i) should be true?


The function constp is used to find expressions which can be evaluated
to a number. If so $sign compares the values. Therefore, I think the
imaginary unit '$%i should not be included, because it is not
comparable.

Dieter Kaiser