Re: substitution within a substitution list
- To: mathgroup at smc.vnet.net
- Subject: [mg88600] Re: [mg88551] substitution within a substitution list
- From: "Adriano Pascoletti" <adriano.pascoletti at gmail.com>
- Date: Fri, 9 May 2008 03:26:52 -0400 (EDT)
- References: <200805080813.EAA14310@smc.vnet.net>
A solution using ReplaceAll (/.) and RuleDelayed ( :> ):
{a -> 1, b -> 2, c -> 2} /. {(b -> i_) :> b -> 10*i}
returns
{a -> 1, b -> 20, c -> 2}
Adriano Pascoletti
On Thu, May 8, 2008 at 10:13 AM, Bipin <bipin.caz at googlemail.com> 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?
>
> Bipin.
>
>
- References:
- substitution within a substitution list
- From: Bipin <bipin.caz@googlemail.com>
- substitution within a substitution list