If I have a rule
oldRule = {a -> 1, b -> 2}
{a->1,b->2}
Then I have a new rule newRule = {a -> 8, c -> 2}.How to use it to update my oldRule?I hope to get
{a->8,b->2,c->2}
Actually I think the Union can implement this target.But it always will choice that small element.I don't know how to control this behavior.
Union[{a -> 8, c -> 2}, oldRule, SameTest -> (SameQ @@ Keys[{##}] &)]
{a -> 1, b -> 2, c -> 2}
Or any elegant workaround can do this?

<|a -> 1, b -> 2, c -> 2|>?It's allowed. – yode May 07 '17 at 06:58Join[oldRule, newRule]works. – Anjan Kumar May 07 '17 at 07:19newNewRule = oldRule /. (a -> 1) :> (a -> 8) // Append[#, c -> 2] &? Also (of course),({a, b, c} /. newNewRule) == ({a, b, c} /. Join[newRule, oldRule])(but not equal to{a, b, c} /. Join[oldRule, newRule]) – user1066 May 07 '17 at 17:57