I want to accumulate the second elements in each sublist identified by its first element.
{
{{1, 1}}, {{2, 1}}, {{3, 1}}, {{2, 2}}, {{5, 1}},
{{2, 1}, {3, 1}},
{{7, 1}}, {{2, 3}}, {{3, 2}},
{{2, 1}, {5, 1}},
{{11, 1}},
{{2, 2}, {3, 1}},
{{13, 1}},
{{2, 1}, {7, 1}},
{{3, 1}, {5, 1}},
{{2, 4}}, {{17, 1}},
{{2, 1}, {3, 2}}
}
For the first eight elements in my list
{{{1, 1}}, {{2, 1}}, {{3, 1}}, {{2, 2}}, {{5, 1}}, {{2, 1}, {3, 1}}, {{7, 1}}, {{2, 3}}}, ...
the desired result is
{{{1, 1}}, {{2, 1}}, {{3, 1}}, {{2, 3}}, {{5, 1}}, {{2, 4}, {3, 2}}, {{7, 1}}, {2, 7}}}, ...
In the result, the first element of each sublist will be the identification element, and the second element is just how much of the first element there are upto any given postition of the list
So for the sixth position in the list, {{2, 1}, {3, 1}}
, the result would be {{2, 4}, {3, 2}}
, because by that time in the list there will be an accumilation of 4 'twos' and 2 'threes'.