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.