$numberp vs mnump



The first and second definitions are the same except that
the second one guards against the possibility of encountering
an expression whose car is not a list.  So far as I know,
all legal expressions in macsyma are either atoms or they
are lists whose cars are lists.  Thus the first two definitions
are equivalent on valid macsyma expressions.  At least as far
as I know.

The third program is intended to be used by the "user", and
presumably would depend on whatever $ratnump etc means at the
time it is called. It may have the same default behavior as
the other two.

Complex numbers are part of common lisp.  Macsyma probably
doesn't use the built-in version for a variety of reasons, some
good. I don't know that this affects any of these programs though.


RJF


Dan Stanger wrote:
> Can anyone provide a example where these 2 functions in simp.lisp would
> provide different values?
> Following are the definitions:
> #-cl
> (DEFMFUN MNUMP (X)
>   (OR (NUMBERP X) (AND (NOT (ATOM X)) (MEMQ (CAAR X) '(RAT BIGFLOAT)))))
> 
> #+cl
> (DEFMFUN MNUMP (X)
>   (OR (NUMBERP X) (AND (NOT (ATOM X))(not (atom (car x)))
>          (MEMQ (CAAR X) '(RAT BIGFLOAT)))))
> 
> and
> 
> (DEFMFUN $NUMBERP (E) (OR ($RATNUMP E) ($FLOATNUMP E) ($BFLOATP E)))
> 
> 
> _______________________________________________
> Maxima mailing list
> Maxima@www.math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima