MathGroup Archive 2011

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

Search the Archive

Re: Replace, test question

  • To: mathgroup at smc.vnet.net
  • Subject: [mg120339] Re: Replace, test question
  • From: Peter Breitfeld <phbrf at t-online.de>
  • Date: Tue, 19 Jul 2011 06:57:52 -0400 (EDT)
  • References: <j0113e$qad$1@smc.vnet.net>

PA32R wrote:

> {58, 61, 15, 66, 10, 2, 24, 81, 45, 84} /. x_ /; PrimeQ -> P

Instead, you should use:

{58, 61, 15, 66, 10, 2, 24, 81, 45, 84} /. x_ /; PrimeQ[x] -> P

or

{58, 61, 15, 66, 10, 2, 24, 81, 45, 84} /. x_?PrimeQ -> P

-- 
_________________________________________________________________
Peter Breitfeld, Bad Saulgau, Germany -- http://www.pBreitfeld.de


  • Prev by Date: Find position of nonzero elements
  • Next by Date: Re: I think Omitting the multiplication sign is a big mistake
  • Previous by thread: Re: Replace, test question
  • Next by thread: Re: Replace, test question