MathGroup Archive 2005

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

Search the Archive

Re: this is ridiculous...


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


  • Prev by Date: Re: SymbolName question
  • Next by Date: Re: this is ridiculous...
  • Previous by thread: Re: this is ridiculous...
  • Next by thread: Re: this is ridiculous...