MathGroup Archive 2012

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

Search the Archive

Re: replace one rule in a list of rules

  • To: mathgroup at smc.vnet.net
  • Subject: [mg125603] Re: replace one rule in a list of rules
  • From: nanobio9 <kuokan.liang at gmail.com>
  • Date: Wed, 21 Mar 2012 05:45:06 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <jk1fv4$515$1@smc.vnet.net> <jk4443$e1f$1@smc.vnet.net>

I also believe that Ray's solution with SetDelayed is the most general
and elegant way out. Once you delayed the set rule, you can implement
the rule in anyway, anytime later, to meet your specific need. You
will need to learn more about SetDelay and do exercises by yourself to
master it, though.

Best,
Kuo Kan Liang

> On Mar 17, 12:54 am, Kathryn Isaac <kathryn.is... at gmail.com> wrote:
>
> > I have a list of simple rules. I want to repeatedly replace one of
> > them.  Is the best way to simply prepend the new rules, or is there
> > a "prettier" approach?
>
> > Thanks,
> > Alan Isaac
>
> If all you want to change is the right-hand side of the rule
> then use RuleDelayed with a dummy right-hand-side variable:
>
> rlist = {a -> a1, b :> bx};
> bx = b1; {a,b}/.rlist
> bx = b2; {a,b}/.rlist
>
> {a1,b1}
> {a1,b2}




  • Prev by Date: Re: Different answers in mathematica and my calculator.
  • Next by Date: Re: new functional operator
  • Previous by thread: Re: replace one rule in a list of rules
  • Next by thread: Solving multiple equations