Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2007
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

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?
> 
> 


  • Prev by Date: New 3D graphics primitives in Mathematica 5.2
  • Next by Date: Re: a tutorial finder palette
  • Previous by thread: Re: About Condition and HoldAll
  • Next by thread: weird behavior when plotting multiple functions in 6.0