Re: How To Change A Rule
- To: mathgroup at smc.vnet.net
- Subject: [mg32369] Re: [mg32334] How To Change A Rule
- From: jmt <jmt at agat.net>
- Date: Wed, 16 Jan 2002 03:30:49 -0500 (EST)
- References: <200201150730.CAA04564@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Try this :
myRules = {s1 -> -11, s2 -> 12}
myRules /. Rule[k_, _?(# < 0 &)] -> (k -> 0)
On Tuesday 15 January 2002 08:30, Ariel Fligler wrote:
> Greetings,
>
> I'm quite newby to Mathematica programming and will thank you if you could
> help me solve the following:
>
> I have a list of rules of the form:
> {s1->-11, s2->12}
> And would like to change every rule in the list that it's RHS is negative
> to 0 so that I will get:
> {s1->0, s2->12}
> I tried to find an access function to manipulate rules but could not.
>
> Any help ?
>
> TIA,
>
> Ariel.
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> Thanks,
>
> Ariel Fligler
- References:
- How To Change A Rule
- From: Ariel Fligler <ariel.fligler@cellpay.biz>
- How To Change A Rule