2048-like array shift Assume we want to shift an array like it is done in the 2048 game: if we have two equal consecutive elements in array, merge them into twice the value element.
Shift must return a new array, where every pair of consecutive equal elements is replaced with their sum, and pairs should not intersect. 
Shifting is performed only once, so we don't need to merge resulting values again.
Notice that if we have 3 consecutive equal elements, we have to sum rightmost ones, so for example, [2, 2, 2] should become [2, 4], not [4, 2].

The task is to write shortest function which takes an array and returns a shifted array.

You may assume that all integers will be strictly positive.

Examples: 

[] -&gt; []
[2, 2, 4, 4] -&gt; [4, 8]
[2, 2, 2, 4, 4, 8] -&gt; [2, 4, 8, 8]
[2, 2, 2, 2] -&gt; [4, 4]
[4, 4, 2, 8, 8, 2] -&gt; [8, 2, 16, 2]
[1024, 1024, 512, 512, 256, 256] -&gt; [2048, 1024, 512]
[3, 3, 3, 1, 1, 7, 5, 5, 5, 5] -&gt; [3, 6, 2, 7, 10, 10]


I am also very interested in solution using reduce :)
Jelly, 10 9 8 bytes
Œg+2/€UF

TryItOnline or run all test cases
How?
Œg+2/€UF - Main link: a                 e.g. [2,2,2,4,4,8]
Œg       - group runs of equal elements      [[2,2,2],[4,4],[8]]
   2/€   - pairwise reduce for each with
  +      -     addition                      [[4,2],[8],[8]]
      U  - reverse (vectorises)              [[2,4],[8],[8]]
       F - flatten list                      [2,4,8,8]