Re: ValueQ
- To: mathgroup at smc.vnet.net
- Subject: [mg34343] Re: [mg34327] ValueQ
- From: Andrzej Kozlowski <andrzej at platon.c.u-tokyo.ac.jp>
- Date: Thu, 16 May 2002 05:08:24 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
One Way: Give up Table, Use Array. In[1]:= a[1]=2; In[2]:= Array[ValueQ[a[#]]&,{2}] Out[2]= {True,False} Andrzej Kozlowski Toyama International University JAPAN http://platon.c.u-tokyo.ac.jp/andrzej/ On Wednesday, May 15, 2002, at 04:35 PM, rainer wrote: > Hi, > > I#m searching for a simple workaround of the following behaviour. > > For the symbol 'a' I've defined > > In[1]:= > a[1] = 2; > > When I evaluate ValueQ for a defined and for not a defined expression I > get what I expect: > > In[3]:= > ValueQ[a[1]] > Out[3]= > True > > In[4]:= > ValueQ[a[2]] > Out[4]= > False > > But when I evaluate ValueQ e. g. within a Table I always get True: > > In[5]:= > Table[ValueQ[a[i]], {i, 1, 2}] > Out[5]= > {True, True} > > The 2nd 'True' is because 'a[i]' is not equal to 'a[2]'. A first > solution to get the expected result is > > In[6]:= > Table[ToExpression@("ValueQ[a[" <> ToString[i] <> "]]"), {i, 1, 2}] > Out[6]= > {True, False} > > Does anybody know something better? > > Rainer Gruber > JOHANNES KEPLER UNIVERSITY LINZ > Institute of Experimental Physics > Atomic Physics and Surface Science > > > >