Re: Pattern matches only when named
- To: mathgroup at smc.vnet.net
- Subject: [mg43898] Re: Pattern matches only when named
- From: Tom Burton <tburton at brahea.com>
- Date: Fri, 10 Oct 2003 03:06:17 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
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