MathGroup Archive 2006

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

Search the Archive

Re: perplexed by blank sequence in pattern replacement


Blake wrote:

> In[1]:=Replace[a*b*c,Times[mysequence__]:>{mysequence}]
> Out[1]={a b c}
> I expected Out[1]={a,b,c}, from a naieve reading of the full form of
> a*b*c

Times[mysequence__] was evaluated to yield just mysequence__ before the
replacement began.  You can put Trace[  ... ] around your original
command to see what happened.  This will do what you want:

Replace[a*b*c, HoldPattern[Times[mysequence__]] :> {mysequence}]


  • Prev by Date: Numerically eliminate quantifiers
  • Next by Date: Re: perplexed by blank sequence in pattern replacement
  • Previous by thread: Re: perplexed by blank sequence in pattern replacement
  • Next by thread: Re: perplexed by blank sequence in pattern replacement