Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2011

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

Search the Archive

Re: pattern example

  • To: mathgroup at smc.vnet.net
  • Subject: [mg119826] Re: pattern example
  • From: Bob Hanlon <hanlonr at cox.net>
  • Date: Fri, 24 Jun 2011 07:46:10 -0400 (EDT)
  • Reply-to: hanlonr at cox.net

$Version

"8.0 for Mac OS X x86 (64-bit) (February 23, 2011)"

f[3/5, 4, 5, 2/3] /. f[x : (_Integer | _Rational) ..] :> {x}

{3/5, 4, 5, 2/3}


Bob Hanlon

---- Francisco Gutierrez <fgutiers2002 at yahoo.com> 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




  • Prev by Date: Put; Using Put to save large lists of data is very slow.
  • Next by Date: Re: pattern example
  • Previous by thread: Re: pattern example
  • Next by thread: Re: pattern example