Re: this is ridiculous...
- To: mathgroup at smc.vnet.net
- Subject: [mg61816] Re: this is ridiculous...
- From: Bill Rowe <readnewsciv at earthlink.net>
- Date: Mon, 31 Oct 2005 01:17:09 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
On 10/30/05 at 12:43 AM, chris.chiasson at gmail.com (Chris Chiasson) wrote: >Can anyone replicate the pattern replacement problem I am having >with Equal? >In[1]:=d == 2 /. Equal[x__] :> tree[x] >willow[d, 2] /. willow[x__] :> tree[x] >$Version >Out[1]=d == 2 >Out[2]=tree[d, 2] >Out[3]="5.2 for Microsoft Windows (June 20, 2005)" <original replaced with InputForm to improve readability> Yes, I get the same result. The issue is the pattern Equal[x___]. Specifically, In[6]:=Equal[x___] Out[6]=True So, when Mathematica evaluates the rule, it becomes True :> tree[x] and since True doesn't appear in the original expression the output is Equal[d,2]. It appears what you are trying to do is change the Head of Equal[d,2]. Wouldn't it be simpler to do tree@@Equal[d,2] ? -- To reply via email subtract one hundred and four