Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #10562

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

From Richard Fateman <fateman@cs.berkeley.edu>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: altering each member of a list that matches a certain pattern
Date 2012-06-21 09:18 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <jruoti$fj9$1@smc.vnet.net> (permalink)
References <jrrvjp$4sn$1@smc.vnet.net>

Show all headers | View raw


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.

Back to comp.soft-sys.math.mathematica | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

altering each member of a list that matches a certain pattern Jason Ebaugh <ebaughjason@gmail.com> - 2012-06-20 07:54 +0000
  Re: altering each member of a list that matches a certain pattern Richard Fateman <fateman@cs.berkeley.edu> - 2012-06-21 09:18 +0000
  Re: altering each member of a list that matches a certain pattern David Bailey <dave@removedbailey.co.uk> - 2012-06-21 09:22 +0000
  Re: altering each member of a list that matches a certain pattern "Chris Degnen" <degnen@cwgsy.net> - 2012-06-21 09:19 +0000
  Re: altering each member of a list that matches a certain pattern David Reiss <dbreiss@gmail.com> - 2012-06-21 09:26 +0000
  Re: altering each member of a list that matches a certain pattern Vince Virgilio <blueschi@gmail.com> - 2012-06-22 07:00 +0000
  Re: altering each member of a list that matches a certain pattern awnl <awnl@gmx-topmail.de> - 2012-06-22 07:03 +0000

csiph-web