MathGroup Archive 2006

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

Search the Archive

ReplaceAll (/.)

  • To: mathgroup at
  • Subject: [mg69197] ReplaceAll (/.)
  • From: Bruce Colletti <vze269bv at>
  • Date: Fri, 1 Sep 2006 06:41:51 -0400 (EDT)
  • Sender: owner-wri-mathgroup at

Re Mathematica

Why doesn't:

               (a b) /. x_Times -> List @@ x

return {a,b}?  My (flawed) reasoning is that a b has form Times[a,b], and so x matches to Times[a,b].  List@@x replaces Times with List to yield List[a,b], or {a,b}...or so it would seem.

The explanation is somehow linked to the fact that:

               (a b) /. x_Times :> List @@ x

returns {a,b}, but I don't see why this works but not the above.  

Although List@@(a,b) returns {a,b}, I want to use the above ReplaceAll function (this example here is taken from a larger problem).  



  • Prev by Date: Re: efficient term collection algorithm
  • Next by Date: Re: Can't Remove[] variable "K"? (Really strange behavior . . . )
  • Previous by thread: RE: How to identify "intersections" between to data sets?
  • Next by thread: Re: ReplaceAll (/.)