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

MathGroup Archive 2008

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

Search the Archive

Re: substitution within a substitution list

  • To: mathgroup at smc.vnet.net
  • Subject: [mg88583] Re: substitution within a substitution list
  • From: Szabolcs Horvát <szhorvat at gmail.com>
  • Date: Fri, 9 May 2008 03:23:44 -0400 (EDT)
  • Organization: University of Bergen
  • References: <fvudmu$ebg$1@smc.vnet.net>

Bipin wrote:
> HI,
> 
> I'm trying to find a way of changing the substitution values within a
> substitution list.
> 
> For example, if I have the following substitution list:-
> 
> subs = {a->1, b->2, c->2}
> 
> I want to programmatically replace the value associated with 'b' from
> 2 to 20, ie ending up with
> 
> subs = {a->1, b->20, c->2}
> 
> Does anyone know of a mathematica function for doing this?
> 

ReplaceAll works fine:

In[1]:= subs = {a -> 1, b -> 2, c -> 2}
Out[1]= {a -> 1, b -> 2, c -> 2}

In[2]:= subs /. (b -> _) -> (b -> 20)
Out[2]= {a -> 1, b -> 20, c -> 2}


  • Prev by Date: Re: list of dates
  • Next by Date: Re: substitution within a substitution list
  • Previous by thread: Re: substitution within a substitution list
  • Next by thread: Re: substitution within a substitution list