Re: Pattern matches only when named
- To: mathgroup at smc.vnet.net
- Subject: [mg43878] Re: Pattern matches only when named
- From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
- Date: Fri, 10 Oct 2003 03:05:47 -0400 (EDT)
- Organization: Universitaet Leipzig
- References: <bm2ugv$6so$1@smc.vnet.net>
- Reply-to: kuska at informatik.uni-leipzig.de
- Sender: owner-wri-mathgroup at wolfram.com
Hi, and _ + _ is simplifyed to 2 _ and this does not match a sum. While u_ + _ can not simplifyed and matches your sum. You must use f + g /. HoldPattern[ _ + _] -> h and all works as expected. Regards Jens Ken Morgan wrote: > > 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