Re: Pattern matches only when named
- To: mathgroup at smc.vnet.net
- Subject: [mg43908] Re: Pattern matches only when named
- From: Oliver Friedrich <oliver.friedrich at tzm.de>
- Date: Sat, 11 Oct 2003 01:33:28 -0400 (EDT)
- Organization: TZ Mikroelektronik
- References: <bm2ugv$6so$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Ken Morgan <kemorgan at vt.edu> wrote in news:bm2ugv$6so$1 at smc.vnet.net: > Just a curiosity: > > In[1]:= f + g /. u_ + _ -> h > Out[1]:= h > > but > > In[2]:= f + g /. _ + _ -> h > Out[2]:= f + g > > Why does the pattern match only when one of the Blanks has a name? > > > Thanks, > Ken > > Hi Ken, In your second example the blank stands for an idendical expression. So this pattern matches only when both expressions left and right from the plus are the same. Try f+f/._+_->h and look what happens. You're welcome ;-) Regards Oliver Friedrich