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

MathGroup Archive 2012

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

Search the Archive

Re: altering each member of a list that matches a certain pattern

  • To: mathgroup at smc.vnet.net
  • Subject: [mg126967] Re: altering each member of a list that matches a certain pattern
  • From: Richard Fateman <fateman at cs.berkeley.edu>
  • Date: Thu, 21 Jun 2012 05:17:06 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <jrrvjp$4sn$1@smc.vnet.net>

On 6/20/2012 12:54 AM, Jason Ebaugh wrote:

>
> Am I missing a more straightforward way to do this?
Yes. Why not just...

Table[If[x > 9, SuperStar[x], x], {x, list}]

this does not affect the data in list.

OR


Map[Function[{x}, If[x > 9, SuperStar[x], x]], list]

which is, I expect, just as efficient and far more readable than your

If[# > 9, SuperStar[#], #] & /@ list

The non-alpha sequence [#]#]&/@   is hardly the worst puzzle
that can be constructed in 8 characters, but is, to me
unnecessarily obscure.



  • Prev by Date: Re: altering each member of a list that matches a certain pattern
  • Next by Date: Re: Bug in Sort !?!?
  • Previous by thread: Re: altering each member of a list that matches a certain pattern
  • Next by thread: Re: altering each member of a list that matches a certain pattern