Skip to main content
2 of 2
added 109 characters in body
Ali Hashmi
  • 9.1k
  • 4
  • 22
  • 43
list = {{a -> 1, b -> 2}, {a -> 3, b -> 4}};
Normal@GroupBy[Flatten@list, Keys -> Values, Total];
(* {a -> 4, b -> 6} *)

Thread[Union @@ Keys[#] -> Apply[Plus, Values[#], {1}]]&@ Transpose[list]
(* {a -> 4, b -> 6} *)

as suggested by @J.M.

Normal@Merge[{{a -> 1, b -> 2}, {a -> 3, b -> 4}}, Total] (* applying Normal if you
want the answer with Head list *)
Ali Hashmi
  • 9.1k
  • 4
  • 22
  • 43