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


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

Re: replace one rule in a list of rules

From nanobio9 <kuokan.liang@gmail.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: replace one rule in a list of rules
Date 2012-03-21 10:46 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <jkcbhk$qet$1@smc.vnet.net> (permalink)
References <jk1fv4$515$1@smc.vnet.net> <jk4443$e1f$1@smc.vnet.net>

Show all headers | View raw


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...@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}

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


Thread

replace one rule in a list of rules Kathryn Isaac <kathryn.isaac@gmail.com> - 2012-03-17 07:54 +0000
  Re: replace one rule in a list of rules Ray Koopman <koopman@sfu.ca> - 2012-03-18 07:50 +0000
    Re: replace one rule in a list of rules nanobio9 <kuokan.liang@gmail.com> - 2012-03-21 10:46 +0000
  Re: replace one rule in a list of rules Murta <rodrigomurtax@gmail.com> - 2012-03-18 07:51 +0000
  Re: replace one rule in a list of rules Peter Pein <petsie@dordos.net> - 2012-03-18 07:56 +0000
    Re: replace one rule in a list of rules Alan <alan.isaac@gmail.com> - 2012-03-19 10:00 +0000
    Re: replace one rule in a list of rules Christoph Lhotka <christoph.lhotka@fundp.ac.be> - 2012-03-20 07:24 +0000

csiph-web