Re: How To Change A Rule

*To*: mathgroup at smc.vnet.net*Subject*: [mg32349] Re: How To Change A Rule*From*: "Borut L" <borut at email.si>*Date*: Wed, 16 Jan 2002 03:29:59 -0500 (EST)*References*: <a20mon$4hf$1@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

Hi, I'd do it like this, tough I think there are more elegant ways. In[1]:= temp = Table[u[i] -> Random[Integer, {-10, 10}], {i, 5}] Out[1]= {u[1] -> 8, u[2] -> 3, u[3] -> -4, u[4] -> 7, u[5] -> -3} In[2]:= If[Last[#] < 0, ReplacePart[#, 0, 2], #] & /@ temp Out[2]= {u[1] -> 8, u[2] -> 3, u[3] -> 0, u[4] -> 7, u[5] -> 0} Hope you get any better suggestion :) Borut "Ariel Fligler" <ariel.fligler at cellpay.biz> wrote in message news:a20mon$4hf$1 at smc.vnet.net... > 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 > > >