MathGroup Archive 2003

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

Search the Archive

Re: Pattern matches only when named


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


  • Prev by Date: Re: 3D Plots
  • Next by Date: Simplifying Exponents
  • Previous by thread: RE: Pattern matches only when named
  • Next by thread: Re: Pattern matches only when named