MathGroup Archive 2003

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

Search the Archive

Re: Pattern matches only when named


Hello,

It's easy to see that _+_ (but not u_+_) evaluates to 2 _ and then no longer
matches. You can prevent evaluation within the pattern with

f+g /. HoldPattern[_+_] -> h

Tom Burton

On 10/8/03 8:17 PM, in article bm2ugv$6so$1 at smc.vnet.net, "Ken Morgan"
<kemorgan at vt.edu> wrote:

> In[1]:=   f + g /. u_ + _ -> h
> Out[1]:=  h
> 
> but
> 
> In[2]:=   f + g /. _ + _ -> h
> Out[2]:=  f + g


  • Prev by Date: Re: question..
  • Next by Date: Re: 3D Plots
  • Previous by thread: Re: Pattern matches only when named
  • Next by thread: Re: Pattern matches only when named