Re: Re: Strange ReplaceRepeated
- To: mathgroup at smc.vnet.net
- Subject: [mg17173] Re: [mg17114] Re: [mg17037] Strange ReplaceRepeated
- From: David Withoff <withoff>
- Date: Sun, 18 Apr 1999 23:53:17 -0400
- Sender: owner-wri-mathgroup at wolfram.com
> Thanks all, who pointed that FullForm of
> Infinity is DirectedInfinity[1].
>
> However if I replace _?NumberQ by _?(NumberQ[#]&)
> then everything works as expected. This is because
> NumberQ[Infinity]-> False.
> According to A. Hayes (do You hear Allan?)
> recommendation (see How-Why74.nb ) both patterns
> should give the same answer. I think this
> behaviour is at least misleading.
>
> Arturas Acus
> Institute of Theoretical
> Physics and Astronomy
> Gostauto 12, 2600,Vilnius
> Lithuania
>
> E-mail: acus at itpa.lt
> Fax: 370-2-225361
> Tel: 370-2-612906
I'm not sure I understand what you did. I assume that
this is referring to the example:
tarp=List[
List[AuxVertex[List[List[i2],m2]],
CG[List[i1,m1],List[i2,m2],List[i3,F[m3]]],
WD[i1,List[List[m1],List[m2]],List[q0]]],
List[AuxVertex[List[List[i1],m1]],
CG[List[i1,m1],List[i2,m2],List[i3,F[m3]]],
WD[i1,List[List[m1],List[m2]],List[q0]]]]
tarp//.{F[_]:>S[Infinity],_?NumberQ:>S[Infinity]}
which gives an infinite loop. When I instead used
tarp//.{F[_]:>S[Infinity],_?(NumberQ[#]&):>S[Infinity]}
though, I still (as I expected) got an infinite loop. I would not
expect this sort of difference between _?NumberQ and _?(NumberQ[#]&).
Is that the only change you made?
Dave Withoff
Wolfram Research