MathGroup Archive 2010

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

Search the Archive

Re: ReplaceAll reloaded

  • To: mathgroup at smc.vnet.net
  • Subject: [mg107397] Re: [mg107363] ReplaceAll reloaded
  • From: Leonid Shifrin <lshifr at gmail.com>
  • Date: Thu, 11 Feb 2010 07:08:01 -0500 (EST)
  • References: <hkeb04$t7v$1@smc.vnet.net> <4B6AB3AA.1080805@gmail.com>

Istvan,

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