Re: About Condition and HoldAll
- To: mathgroup at smc.vnet.net
- Subject: [mg76072] Re: About Condition and HoldAll
- From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
- Date: Wed, 16 May 2007 05:17:06 -0400 (EDT)
- Organization: Uni Leipzig
- References: <f2bsiu$gj4$1@smc.vnet.net>
- Reply-to: kuska at informatik.uni-leipzig.de
Hi,
because Condition[1 + 1, 2 + 3] is a pattern that
does nothing when the pattern matcher is not used
Regards
Jens
solidifire wrote:
> In[1]:= {f[1 + 1, 2 + 3], g[1 + 1, 2 + 3], h[1 + 1, 2 + 3]}
> Out[1]= {f[2, 5], g[2, 5], h[2, 5]}
>
> In[2]:= SetAttributes[f, HoldAll]
>
> In[3]:= SetAttributes[g, HoldRest]
>
> In[4]:= {f[1 + 1, 2 + 3], g[1 + 1, 2 + 3], h[1 + 1, 2 + 3]}
> Out[4]= {f[1 + 1, 2 + 3], g[2, 2 + 3], h[2, 5]}
>
> In[5]:= Attributes[Condition]
> Out[5]= {HoldAll, Protected}
>
> In[6]:= Condition[1 + 1, 2 + 3]
> Out[6]= 2 /; 2 + 3
>
> The version of Mathematica is 5.0 for Microsoft Windows.
>
> My question is that why does Condition behave as having HoldRest
> as attribute although the attribute is HoldAll actually?
>
>