Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #1929 > unrolled thread

Re: HoldAll/HoldRest

Started byAlbert Retey <awnl@gmx-topmail.de>
First post2011-04-30 09:53 +0000
Last post2011-04-30 09:53 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.soft-sys.math.mathematica

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: HoldAll/HoldRest Albert Retey <awnl@gmx-topmail.de> - 2011-04-30 09:53 +0000

#1929 — Re: HoldAll/HoldRest

FromAlbert Retey <awnl@gmx-topmail.de>
Date2011-04-30 09:53 +0000
SubjectRe: HoldAll/HoldRest
Message-ID<ipgm60$8re$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

[toc] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web