MathGroup Archive 2007

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

Search the Archive

About Condition and HoldAll

  • To: mathgroup at smc.vnet.net
  • Subject: [mg76030] About Condition and HoldAll
  • From: solidifire <barabbasgospel at yahoo.com.tw>
  • Date: Tue, 15 May 2007 04:48:59 -0400 (EDT)

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: Residue Function
  • Next by Date: Re: Deleting duplicates from a list
  • Previous by thread: Re: Residue Function
  • Next by thread: Re: About Condition and HoldAll