MathGroup Archive 2011

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

Search the Archive

Re: pattern example


On 23 Jun 2011, at 13:25, Francisco Gutierrez wrote:

> I find in Leonid's (Shiffrin) excellent book the following example (p. 122):
> f[3/5,4,5,2/3]/.f[x:(_Integer|_Rational)..]:>{x}
>
> According to the book, this returns {3/5,4,5,2/3}
>
> However, I get (Mathematica 8.0.1, Windows 7) f[3/5,4,5,2/3]
>
> What's wrong?
> Francisco
>

Nothing. It works fine here. Try again but if you are still having problems try this:


f[3/5,4,5,2/3]/.f[x:Repeated[Alternatives[Blank[Integer],Blank[Rational]]]]:>{x}

Does this work for you now?

Andrzej Kozlowski



  • Prev by Date: Re: pattern example
  • Next by Date: Re: Again : Is there a BNF for Mathematica?
  • Previous by thread: Re: pattern example
  • Next by thread: Re: pattern example