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: [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


  • Prev by Date: Re: question..
  • Next by Date: Re: 3D Plots
  • Previous by thread: Re: Pattern matches only when named
  • Next by thread: Re: Pattern matches only when named