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=