Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2003
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2003

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

Search the Archive

Re: Pattern matches only when named

  • To: mathgroup at smc.vnet.net
  • Subject: [mg43900] Re: Pattern matches only when named
  • From: "wouter meeussen" <wouter.meeussen at pandora.be>
  • Date: Fri, 10 Oct 2003 03:06:21 -0400 (EDT)
  • References: <bm2ugv$6so$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

FullForm[  _ + _ -> h]

Rule[Times[2, Blank[]], h] (* both blanks need be equal *)



FullForm[  u_ + _ -> h]

Rule[Plus[Blank[], Pattern[u, Blank[]]], h] (* both can be different, or not
*)



Wouter.





"Ken Morgan" <kemorgan at vt.edu> wrote in message
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
>


  • Prev by Date: Re: Pattern matches only when named
  • Next by Date: Partial dérivates
  • Previous by thread: Re: Pattern matches only when named
  • Next by thread: RE: Pattern matches only when named