Re: HoldAll/HoldRest
- To: mathgroup at smc.vnet.net
- Subject: [mg118510] Re: HoldAll/HoldRest
- From: Albert Retey <awnl at gmx-topmail.de>
- Date: Sat, 30 Apr 2011 05:52:50 -0400 (EDT)
- References: <ipe7mu$r23$1@smc.vnet.net>
Hi, > Some kind of issue going on here between the interactions of HoldAll > of ValueQ[...] and HoldRest of If[...]. Anyone know the solution so > that Out[3] results in True? It's Function which evaluates its arguments by default, you can do: valueQ = Function[Null, If[ValueQ[#], #, False], HoldAll] to avoid that. > = = In[1]:= valueQ = If[ValueQ[#], #, > False]& = > > = Out[1]= If[ValueQ[#1], #1, False]& = > > = In[2]:= x = 5 = > > = Out[2]= 5 = > > = In[3]:= valueQ[5] = > > = Out[3]= False I guess that should be valueQ[x], otherwise you shouldn't wonder about the result... hth, albert