I have a list of the form:
{{1, 0, 1}, {2, 1, 2}, {1, 0, 3}, {2, 4, 2}, {2, 1, -1}, {1, 0 ,0}}
that I would like to sort such that I calculate the sum over the third column whenever the first two columns are equal. I.e. in this case the output would be
{{1, 0, 1 + 3 + 0}, {2, 1, 2 + (-1)}, {2, 4, 2}}
or
{{1, 0, 4},{2, 1, 1},{2, 4, 2}}
Is there an elegant way to do this?
Flattenaround the mapped function. $\endgroup$