MathGroup Archive 2010

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

Search the Archive

Re: ReplaceAll reloaded

  • To: mathgroup at
  • Subject: [mg107397] Re: [mg107363] ReplaceAll reloaded
  • From: Leonid Shifrin <lshifr at>
  • Date: Thu, 11 Feb 2010 07:08:01 -0500 (EST)
  • References: <hkeb04$t7v$> <>


all you need is to run Trace - it shows pretty clearly what happens:

In[3]:= Or[a,b]/.Or[x__]:>{x}//Trace

Out[3]= {{{Or[x__],x__},x__:>{x},x__:>{x}},a||b/.x__:>{x},{a||b}}

<Or> on your pattern evaluates to the pattern itself before the match is
attempted. This is due
to the behavior of Or on any single argument - it just returns the argument=

  • Prev by Date: Re: Re: Upright \[Micro] in AxesLabel
  • Next by Date: Re: ReplaceAll reloaded
  • Previous by thread: ReplaceAll reloaded
  • Next by thread: Re: ReplaceAll reloaded