Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2010

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

Search the Archive

Re: Re: Replace list element based on a condition how to

  • To: mathgroup at smc.vnet.net
  • Subject: [mg106763] Re: [mg106747] Re: Replace list element based on a condition how to
  • From: Canopus56 <canopus56 at yahoo.com>
  • Date: Sat, 23 Jan 2010 07:30:22 -0500 (EST)
  • References: <201001221040.FAA02940@smc.vnet.net>

Thanks to all for the many great replies in this thread. That clears up my misunderstanding of how datatypes are implemented in Mathematica.  I can see they may result in replace pattern failures if you are not mindful of a variable's datatype. - Kurt 

----- Original Message ----
From: Bill Rowe <readnews at sbcglobal.net>
To: mathgroup at smc.vnet.net
Sent: Fri, January 22, 2010 3:40:26 AM
Subject: [mg106763] [mg106747] Re: Replace list element based on a condition how to

On 1/21/10 at 4:53 AM, canopus56 at yahoo.com (Canopus56) wrote:

>Another newbie type question.  Several responders recommended:

>>In[18]:= lst1 /. n_Integer :> fncHourFix[n]

>Q1.  What is the "_Integer" part of "n_Integer"?

This and more is answered in the documentation. See
tutorial/PatternsOverview for various details about patterns and
pattern matching. For a the specific answer to the question
above, see the fourth entry which can be directly accessed as tutorial/SpecifyingTypesOfExpressionInPatterns
. . .. 


  • Prev by Date: Re: Bug in exporting animation
  • Next by Date: Creating new ColorFunction / ColorDataFunction
  • Previous by thread: Re: Replace list element based on a condition how to
  • Next by thread: Finding and changing strings in a matrix