Re: Unacceptable bug in Mathematica

*To*: mathgroup at smc.vnet.net*Subject*: [mg93548] Re: Unacceptable bug in Mathematica*From*: ragfield <ragfield at gmail.com>*Date*: Thu, 13 Nov 2008 21:09:44 -0500 (EST)*References*: <gfgqf2$dj0$1@smc.vnet.net>

On Nov 13, 3:02 am, psycho_dad <s.nesse... at gmail.com> 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. -Rob