MathGroup Archive 2008

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Unacceptable bug in Mathematica

On Nov 13, 3:02 am, psycho_dad <s.nesse... at> wrote:
> The other day, a friend discovered something that may qualify as a
> major bug in Mathematica (tested in 6.0.3):
> SyntaxQ["Exp[]"]
> (notice that Exp has no argument) returns
> True !!!!
> According to the documentation:
> SyntaxQ["string"] returns True if the string corresponds to
> syntactically correct input for a single Mathematica expression, and
> returns False otherwise.
> At least for me Exp[] is not syntactically correct. I expected more
> from Mathematica...

This absolutely is valid syntax.  Valid syntax is anything that will
successfully parse into an unevaluated Mathematica expression.  Once
it is evaluated it may or may not produce a useful result, but that
does not mean it isn't syntactically valid.  Consider the following:

In[1]:= f[]

Out[1]= f[]

In[2]:= SyntaxQ["f[]"]

Out[2]= True

In[3]:= f[] := 1;

In[4]:= f[]

Out[4]= 1

In[5]:= SyntaxQ["f[]"]

Out[5]= True

In the first case the function "f" with zero arguments has no
definition, but it is still valid syntax.  I later give it a
definition and it is still valid syntax.  It would be crazy to think
SyntaxQ["f[]"] would return a different result depending on whether f
[] was defined.


  • Prev by Date: Re: Model the surface of an ellipsoid
  • Next by Date: Re: Unacceptable bug in Mathematica
  • Previous by thread: Re: Unacceptable bug in Mathematica
  • Next by thread: Re: Unacceptable bug in Mathematica