text:
Am I old enough?
It is currently December 31, 2015, 11:59:00pm, and you must be at least 1324900 seconds old to be able to go to the New Year Celebration. Given the year, month, day, hour, minute, and second of your birth, determine if you are old enough to go.
Notes:

Assume that you are in the same timezone.
Leap years are every 4 years, but if the year is a multiple of 100, it is not a leap year, unless it is a multiple of 400.

Remember, this is code-golf, so the code with the smallest number of bytes wins.
Leaderboards
Here is a Stack Snippet to generate both a regular leaderboard and an overview of winners by language.
To make sure that your answer shows up, please start your answer with a headline, using the following Markdown template:
# Language Name, N bytes

where N is the size of your submission. If you improve your score, you can keep old scores in the headline, by striking them through. For instance:
# Ruby, <s>104</s> <s>101</s> 96 bytes

If there you want to include multiple numbers in your header (e.g. because your score is the sum of two files or you want to list interpreter flag penalties separately), make sure that the actual score is the last number in the header:
# Perl, 43 + 2 (-p flag) = 45 bytes

You can also make the language name a link which will then show up in the leaderboard snippet:
# [><>](http://esolangs.org/wiki/Fish), 121 bytes

var QUESTION_ID=95129,OVERRIDE_USER=12537;function answersUrl(e){return"https://api.stackexchange.com/2.2/questions/"+QUESTION_ID+"/answers?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+ANSWER_FILTER}function commentUrl(e,s){return"https://api.stackexchange.com/2.2/answers/"+s.join(";")+"/comments?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+COMMENT_FILTER}function getAnswers(){jQuery.ajax({url:answersUrl(answer_page++),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){answers.push.apply(answers,e.items),answers_hash=[],answer_ids=[],e.items.forEach(function(e){e.comments=[];var s=+e.share_link.match(/\d+/);answer_ids.push(s),answers_hash[s]=e}),e.has_more||(more_answers=!1),comment_page=1,getComments()}})}function getComments(){jQuery.ajax({url:commentUrl(comment_page++,answer_ids),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){e.items.forEach(function(e){e.owner.user_id===OVERRIDE_USER&&answers_hash[e.post_id].comments.push(e)}),e.has_more?getComments():more_answers?getAnswers():process()}})}function getAuthorName(e){return e.owner.display_name}function process(){var e=[];answers.forEach(function(s){var r=s.body;s.comments.forEach(function(e){OVERRIDE_REG.test(e.body)&&(r="
"+e.body.replace(OVERRIDE_REG,"")+"
")});var a=r.match(SCORE_REG);a&&e.push({user:getAuthorName(s),size:+a[2],language:a[1],link:s.share_link})}),e.sort(function(e,s){var r=e.size,a=s.size;return r-a});var s={},r=1,a=null,n=1;e.forEach(function(e){e.size!=a&&(n=r),a=e.size,++r;var t=jQuery("#answer-template").html();t=t.replace("{{PLACE}}",n+".").replace("{{NAME}}",e.user).replace("{{LANGUAGE}}",e.language).replace("{{SIZE}}",e.size).replace("{{LINK}}",e.link),t=jQuery(t),jQuery("#answers").append(t);var o=e.language;/s.lang?1:e.lang<s.lang?-1:0});for(var c=0;c<t.length;++c){var i=jQuery("#language-template").html(),o=t[c];i=i.replace("{{LANGUAGE}}",o.lang).replace("{{NAME}}",o.user).replace("{{SIZE}}",o.size).replace("{{LINK}}",o.link),i=jQuery(i),jQuery("#languages").append(i)}}var ANSWER_FILTER="!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe",COMMENT_FILTER="!)Q2B_A2kjfAiU78X(md6BoYk",answers=[],answers_hash,answer_ids,answer_page=1,more_answers=!0,comment_page;getAnswers();var SCORE_REG=/<h\d>\s*([^\n,]*[^\s,]),.*?(\d+)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/,OVERRIDE_REG=/^Override\s*header:\s*/i;
body{text-align:left!important}#answer-list,#language-list{padding:10px;width:290px;float:left}table thead{font-weight:700}table td{padding:5px}
 <link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b">

Leaderboard

	Author	Language	Size

Winners by Language

Language	User	Score

{{PLACE}}	{{NAME}}	{{LANGUAGE}}	{{SIZE}}	Link

{{LANGUAGE}}	{{NAME}}	{{SIZE}}	Link

1324900 seconds is about two weeks. You need to be two weeks old?

It's not clear whether I have to be that old now or in a minute. Since the question obviously reduces to a single date comparison, it would be clearer to just state the date explicitly.

Python, 28 bytes
[2015,12,16,15,57,20].__le__

Going back 1324900 seconds from December 31, 2015, 11:59:00pm gives December 16, 2015 at 3:57:20 pm. We convert this date to a list and take it's less-than-or-equals method to compare to the input list. This compares it lexicographically, so first by year, then by month, and so on.

Mathematica, 66 bytes
DateObject@{2015,12,31,23,59,0}-DateObject@#>1324899~Quantity~"s"&

Anonymous function. Takes a list of integers as input, and returns True or False as output.


text:
Tips for Golfing in Brain-Flak
Brain-flak is a stack-based turing-tarpit language, written collaboratively between me, DJMcMayhem, and 1000000000.
Some users  are very experienced in the mysterious ways of Brain-Flak. So I thought it a good idea to set up this question as a way for us, and hopefully others too, to share our knowledge with the community and lower the bar of entry to this language "designed to be painful to use". And perhaps even teach those of us with more experience some new tricks.
So what tips do you have for golfing in brain-flak? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to brain-flak (e.g. "remove comments" is not an answer).
Please post one tip per answer.

Use the Third Stack
If you have read the title you might be a bit confused.  Surely there are only two stacks in Brain-Flak?  However I assure you that it exists and it is one of the most powerful if not the most powerful tool in writing and golfing Brain-Flak.

What is the "Third Stack"?
Every Brain-Flak program uses the third stack in one way or another but most of the use goes on behind the scenes and it is often useful to simply ignore the fact that it exists.  Each parenthesis in the program either adds or removes one item from the stack.  Three of the open braces ([< all add an item to the stack while their three conjugates )]> all remove an item from the stack.  The value of the item on the stack is the value of the current scope of the program and using nilads will modify this value in certain ways.  The close parenthesis ) has the unique function of moving an element from the Third Stack to the current stack; a push.
Hopefully this is becoming clear to you.  The Third Stack is some sort of stack that remembers the return values of code that has already been executed.  Let's walk through an example of a simple program keeping track of the two normal stacks and the Third Stack.
Example
We will walk through the following program.  This program pushes -3, 1, -2 to the stack.
(([()()()])(()))

We start with three open braces, which all push a zero to the third stack.
Our stacks now look like this, the Third Stack is the one on the right and the active stack has a ^ under it:
        0
        0
  0  0  0
  ^

(([()()()])(()))
   ^

Now we have three () nilads.  These do not do anything to the normal two stacks, however they do each add one to the top of the Third Stack making our stacks look like:
        3
        0
  0  0  0
  ^

(([()()()])(()))
         ^

Now we encounter a ] as stated before close braces remove an item from the Third Stack, but ] has the function of subtracting the element it removes from the top of the stack.  Thus our new stacks will look like:
       -3
  0  0  0
  ^

(([()()()])(()))
          ^

This makes sense; [...] does negation so ] should subtract downwards.
Now we must execute a ).  As you likely recall ) is the place in the program where stuff gets pushed to the stack so we will be moving the top of the Third Stack to the current stack, in addition we will be adding the -3 to the next element in the third stack.
 -3  0 -3
  ^

(([()()()])(()))
           ^

Once again we encounter one of our three open braces so we will add another element to our Third Stack.
        0
 -3  0 -3
  ^

(([()()()])(()))
            ^

As we said earlier () will increment the top of our third stack by one.
        1
 -3  0 -3
  ^

(([()()()])(()))
              ^

And ) will move the top of the Third Stack onto the active stack and add downwards
  1
 -3  0 -2
  ^

(([()()()])(()))
               ^

The last ) moves the Third Stack onto the active stack and since there are no elements left on the Third Stack for it to add, does nothing else.
 -2
  1
 -3  0
  ^

(([()()()])(()))
                ^

The program is over so we terminate and output.

This example is intended to give you a feel for what the Third Stack is and does.  It does not include all of the operations, but hopefully you can figure out what each of them does on its own.  If you are still struggling I have included a "cheatsheet" at the bottom of this answer to help you along.
Ok, So what?
Ok, now you understand the Third Stack, but "So what"?  You were already using it even if you didn't call it the "Third Stack", how does thinking in terms of the Third Stack help you golf?
Lets look at a problem.  You want to take the Triangle of a number.  This is the sum of all numbers less than n.
One approach might be to create an accumulator on the offstack and add to it as you count down.  This creates code that looks like this:
(<>)<>{(({}[()])()<>{})<>}{}<>({}<>)

Try it Online!
This code is pretty compact and one might think that it can't get much smaller.  However if we approach it from a third stack point of view it become clear that this is grossly inefficient.  Instead of putting our accumulator on the offstack we can put it on the third stack with a ( and retrieve it at the end we use ).  We will once again loop through all the numbers, but this time we don't have to do much of anything to increment our Third Stack, the program does it for us.  This looks like:
({()({}[()])}{})

Try it Online
This code is less than half the size of the pretty well golfed version we made before.  In fact a computer search has proven that this program is the shortest possible program that can perform this task.  This program can be explained using the "sum of all runs" approach, but I think it is a lot more intuitive and clear when explained using a Third Stack approach.
When do I use the Third Stack?
Ideally whenever you begin work on a new problem in Brain-Flak you should think to yourself how would I do this with the Third Stack in mind.  However as a general rule of thumb whenever you have to keep track of some type of accumulator or have a running total it is a good idea to try putting that on your third stack instead of the two real stacks.
Another time that it might be a good idea to consider using your third stack is when you don't have any space to store some value on the other two stacks.  This can be particularly useful when you are doing manipulations on two existing stacks and you want to save a value for later use without having to keep track of where it is.
Limitations of the Third Stack
The Third Stack is very powerful in a lot of ways but it comes with its own limitations and drawbacks.
Firstly, the maximum stack height for the Third Stack at any given point is determined at compile time.  This means that if you want to use an amount of space on the stack you have to allocate that space when you are writing the program.
Secondly the Third Stack is not Random Access.  This means that you cannot perform any operations on any value but the top most value.  In addition you cannot move values around on the stack (say swap the first two elements).
Conclusion
The Third Stack is a powerful tool and I would consider it essential to every Brain-Flak user.  It takes some getting used to and requires a shift in the way your think about programming in Brain-Flak, but when used properly it makes all the difference between a decent and an amazing when it comes to golfing.
Cheatsheet
Here is a list of operations and how they affect the Third Stack
 Operation  |                 Action
====================================================
   (,[,<    | Put a zero on top of the Third Stack
----------------------------------------------------
     )      | Add the top of the Third Stack to the
            | second element and move it to the
            | active stack
----------------------------------------------------
     ]      | Subtract the top of the Third Stack
            | from the second element and pop it
----------------------------------------------------
     >      | Pop the top of the Third Stack
----------------------------------------------------
     ()     | Add one to the top of the Third Stack
----------------------------------------------------
     {}     | Pop the top of the active stack and
            | add it to the top of the Third Stack
----------------------------------------------------
     []     | Add the stack height to the Third
            | Stack
----------------------------------------------------
   <>,{,}   | Nothing

Wow, fantastic tip! I was actually just coming here to write a similar answer when I saw this. +1! I prefer to think of it as The Accumulator, but The Third Stack metaphor is really interesting.

I always called it the "workspace" or "workstack".

On the TIO version of Brainflak, {...} returns the sum of all iterations.

@CalculatorFeline Yes, this is true on nearly all versions of Brain-Flak except for some very early ones.  However I'm not sure why you have commented that on this post in particular.

<>,{,}   | Nothing

@CalculatorFeline Ah, I see.  What I said is correct, {...} does do nothing.  Since { does not create a new scope on the third stack all of its contents are added to any earlier scope.  I could explain this better if I didn't have the character restriction, If you would like to talk further we can move over to the third stack.

Also, the Third Stack interpretation lowers the requirement of everything matching to only {} matching. Also, (<[ are all the same, except for close bracket type.

@DJMcMayhem Accumulator usually implies one integer though...

Finding modulus/remainder
Finding n modulo m is one of the basic arithmetic operations, important for many challenges. For cases m > 0 and n >= 0, the following 46-byte snippet may be used. It assumes that n is on top of the active stack with m the next one down, and replaces them with n mod m. It leaves the rest of the stacks intact.
({}(<>))<>{(({})){({}[()])<>}{}}{}<>([{}()]{})

This annotated version shows the stack contents at some points in the program. ; separates the two stacks and . marks the active stack.
. n m;
({}(<>))<>
{   . m; r 0   (r = n - km)
    (({}))
    . m m; r 0
    {({}[()])<>}
    {}
}
m-n%m-1 m; . 0
{}<>([{}()]{})
. n%m;

It took me a while to understand what the unannotated part did ({({}[()])<>}), but once I figured it out... Genius :-)

Push-Pop Redundancy
This is a big one.  It is also a little bit of a nuanced one.
The idea is that if you push something and then pop it without doing anything you should not have pushed it at all.
For example, if you want to move something to the offstack and then add one to it you might write the following code:
({}<>)({}())

This can be simpler like this:
({}<>())

The first program picks up the item moves it, picks it up again and adds one, while the second one does both in one fell swoop.
That example was simple however it can get a lot more complex.  Take for instance:
({}<({}<>)><>)(<((()()()){}[((){}{})])>)

The reduction is less clear here but the 4th pop in the program can be reduced with the 2nd push, like so:
(<((()()()){}[((){}<({}<>)><>{})])>)

This is the most powerful tool in my golfing repertoire but it takes some practice to get good at it.  Once you have been doing these for a while you will be able to spot these almost instantly.

In the latter example, isn't the part in the first pair of parentheses equivalent to ({}<{}>)?

@feersum No it is not.  It moves a copy of the second item on the stack to the off stack while ({}<{}>) destroys the item entirely.  However these programs were not really meant to be optimal just to highlight the principle at work here.

Optimise your integers
Integers are tedious to represent in Brain-Flak. Fortunately we have a question that will help Golf a Brain-Flak Integer for you. (Note that the question is designed to push the integer to the stack, so push-pop redundancy probably applies to more realistic programs.)

Note that we also have brain-flak.github.io/integer/, which runs one of those algorithms online for convenience.

@DrMcMoylex All we need now as in implementation of the integer metagolfer in Brain-Flak itself!

We have that. http://codegolf.stackexchange.com/a/98054/31716 :D

Push extra loop counters
Frequently, you'll want to do something like

Perform X operation on every element in the stack

or

Perform X operation on every pair of adjacent elements in the stack

When the input may contain '0's, or the result of operation X may give a 0, this is really inconvenient. Because you'll need to do:
([])
{

  {}

  ({}...<>)
  ([])

}

To do X to each element, and then later
<>
([])
{
  {}
  ({}<>)
  <>
  ([])
}
<>

To reverse the array again.
Even worse, if we're operatiing on pairs of adjacent elements, we'll need to do ([][()]) in place of ([]). This is really inconvenient. Here's the trick: While you're doing X to each element, push a 1 over onto the alternate stack right above the X(element). Then, while you're reversing it, you can simply do
<>
{
  {}
  ({}<>)
  <>
}
<>

This is 8 bytes shorter, so when you factor in the extra code to push 1, you'll end up saving 4-6 bytes. For a more concrete example, compare the task of getting deltas of an array. Without this trick, you'd need:
([][()]){

    {}

    ([{}]({})<>)<>

    ([][()])

}{}{}<>

([])
{{}({}<>)<>([])}<>

For 62. With this trick, you'll have
([][()]){

    {}

    ([{}]({})<>)(())<>

    ([][()])

}{}{}<>

{{}({}<>)<>}<>

For 58. If used the right way (for example, reversing first, and removing two ([][()]) from later), this could save even more in speficic scenarios.

Take advantage of the 'Stack-Height' nilad
Especially in kolmogorov-complexity challenges, or challenges where you always know the size of the input, you can take advantage of the 'Stack-Height' nilad [] to create integers.
Let's work through this with a hypothetical challenge: output CAT. The non-golfy way is to use the online integer golfer to push 67, 65, and 84. This gives:
(((((()()()()){}){}){}()){}())

(((((()()()()){}){}){}){}())

((((((()()()){}()){}){})){}{})

(Newlines for clarity). This is 88 bytes, and not that great. If we instead push the consecutive differences between values, we can save a lot. So we wrap the first number in a push call, and subtract 2:
(   (((((()()()()){}){}){}()){}())  [()()] )

Then, we take this code, wrap it in a push call, and add 19 to the end:
(  ((((((()()()()){}){}){}()){}())[()()])   ((((()()()){})){}{}()) )

This is 62 bytes, for a whopping 26 byte golf!
Now here is where we get to take advantage of the stack-height nilad. By the time we start pushing 19, we know that there are already 2 items on the stack, so [] will evaluate to 2. We can use this to create a 19 in fewer bytes. The obvious way is to change the inner ()()() to ()[]. This only saves two bytes though. With some more tinkering, it turns out we can push 19 with
((([][]){})[]{})

This saves us 6 bytes. Now we are down to 56.
You can see this tip being used very effectively on these answers:

Hello World V1

Hello World V2

Magic The Gathering, Friend or Foe

Output The Missing Integer

Diagonal Alphabet (my personal favorite)

Your CAT program actually pushes TAC :P

Also, 52 bytes

I know this is a tip but I can't help myself, 50 bytes.

Another weird but sometimes effective tip to help abuse []: prepending 0s with (<>)s before your code. This only really works if you're planning to push the code in reverse anyway, but if you come across the right number you can reduce your code quite a bit. A rather extreme example where I append 6 0s, which lets me use just as many []s as I use ()

Use the wiki
We have a wiki!  It has some short comings, but it is helpful resource.  It has lists of useful, well golfed, stack clean programs that you can paste into your code.  If you want to do something you think someone might have done before there is a good chance it is on the wiki.

Better looping
Here's an easy one:
A fairly common construct is:
(({})<{({}[()]<...>)}{}>)

Where you want to loop n times but still keep the n. However  this can be written as:
({<({}[()]<...>)>()}{})

to save 2 bytes.
Another fairly common paradigm is
([])({<{}>...<([])>}{})

Which will loop and accumulate the entire stack.  Due to some fancy maths this is the same as:
(([]){[{}]...([])}{})

Check your negatives
Sometimes you can golf a few bytes by strategically choosing what to negate with the [...] monad.
A simple example is in nested [...]s. For example [()()()[()()]] could just be [()()()]()()
Say you want to check whether a value is any of the start brackets (<{[. The initial attempt is to push the difference between each character and loop over subtracting it
({}<(((((       #Push the differences between start bracket characters
(((()()()()){}){}){})   #Push 32
[()])                   #Push 31
[((()()())()){}{}])     #Push 20
){})><>)                #Push 40
<>({<(([{}]<>{}))>(){[()](<{}>)}<>})

However, you can save 4bytes by pushing the negative versions of the differences instead!
({}<(((((       #Push the differences between start bracket characters
((([()()()()]){}){}){}) #Push -32
())                     #Push -31
((()()())()){}{})       #Push -20
){})><>)                #Push -40
<>({<(({}<>{}))>(){[()](<{}>)}<>})

Generally, this doesn't save you very much, but it also costs very little effort to change around what the [...] is surrounding. Be on the lookout for situations where you can push the negative of a counter instead of the positive to save on incrementing multiple times instead of decrementing later. Or swapping out (a[b]) with ([a]b) to make the difference between two numbers negative instead of positive.

Similar things can be done with zeros <a<b>c> -> <abc> and <a[b]c> -> <abc>.

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

sort: votes


text:
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:
[] -> []
[2, 2, 4, 4] -> [4, 8]
[2, 2, 2, 4, 4, 8] -> [2, 4, 8, 8]
[2, 2, 2, 2] -> [4, 4]
[4, 4, 2, 8, 8, 2] -> [8, 2, 16, 2]
[1024, 1024, 512, 512, 256, 256] -> [2048, 1024, 512]
[3, 3, 3, 1, 1, 7, 5, 5, 5, 5] -> [3, 6, 2, 7, 10, 10]

I am also very interested in solution using reduce :)

This is a very nice first challenge. Welcome to the site!

Related. Related. (There are several other 2048-based challenges, but the merging operation is most important in these two I think.)

Input is not necessarily sorted and numbers are greater than zero, that is the only restriction on numbers. We may let largest value fit in standard int32 bounds i think. Empty array gives empty array as a result.
Thanks for the participation, appreciate that :)

To those still voting to close as unclear, the challenge essentially boils down to this: Assume you have an array of positive integers. Walk through it from end to start. If the current element is equal to the next, replace it with the sum of both and move to the element after the replacement, then perform this check again for that element and the next. Repeat until the beginning of the array is reached.

Is [4,2,8,8] valid output for [2,2,2,4,4,8]?

@Titus "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 ruling on empty arrays is unfortunate; it has invalidated a few answers, including my own.

I'm guessing APL would be a good language for writing a 2048 game.

Can we assume that the array length is always even, like in your examples?

No, it can be odd also. I wonder about an approach in which it will make a difference, could you share? :)

I think the answers that use string processing rather than an array should be disqualified, unless they first serialise the array, then string process it, then deserialise it again.

@Joe Correct.

This might be a little to late, but can you input a reversed list or is the order to be kept the right way?

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]

Haskell, 47 57 50 bytes
e#l|a:b<-l,e==a= -2*a:b|1<2=e:l
map abs.foldr(#)[]

Uses reduce (or fold as it is called in Haskell, here a right-fold foldr). Usage example: map abs.foldr(#)[] $ [2,2,2,4,4,8] -> [2,4,8,8].
Edit: +10 bytes to make it work for unsorted arrays, too. Merged numbers are inserted as negative values to prevent a second merge. They are corrected by a final  map abs.

The trick with negatives is really nice!

Brain-Flak, 158 96
{({}<>)<>}<>{(({}<>)<><(({})<<>({}<>)>)>)({}[{}]<(())>){((<{}{}>))}{}{{}(<({}{})>)}{}({}<>)<>}<>

Try it online!
Explanation:
1 Reverse the list (moving everything to the other stack, but that doesn't matter)
{({}<>)<>}<>
{        }   #keep moving numbers until you hit the 0s from an empty stack
 ({}<>)      #pop a number and push it on the other stack
       <>    #go back to the original stack
          <> #after everything has moved, switch stacks

2 Do steps 3-6 until there is nothing left on this stack:
{                                                                                }

3 Duplicate the top two elements (2 3 -> 2 3 2 3)
(({}<>)<><(({})<<>({}<>)>)>)

(({}<>)<>                   #put the top number on the other stack and back on the very top
         <(({})             #put the next number on top after:
               <<>({}<>)>   #copying the original top number back to the first stack
                         )>)

4 Put a 1 on top if the top two are equal, a 0 otherwise (from the wiki)
({}[{}]<(())>){((<{}{}>))}{}

5 If the top two were equal (non-zero on the top) add the next two and push the result
{{}(<({}{})>)}{}
{            }   #skip this if there is a 0 on top
 {}              #pop the 1
   (<      >)    #push a 0 after:
     ({}{})      #pop 2 numbers, add them together and push them back on
              {} #pop off the 0

6 Move the top element to the other stack
({}<>)<>

7 Switch to the other stack and print implicitly
<>

pls add comma after language name, otherwise it breaks leaderboard ty :P

PHP, 116 Bytes
<?$r=[];for($c=count($a=$_GET[a]);$c-=$x;)array_unshift($r,(1+($x=$a[--$c]==$a[$c-1]))*$a[$c]);echo json_encode($r);

or
<?$r=[];for($c=count($a=$_GET[a]);$c--;)$r[]=$a[$c]==$a[$c-1]?2*$a[$c--]:$a[$c];echo json_encode(array_reverse($r));

-4 Bytes if the output can be an array print_r instead of 'json_encode`
176 Bytes to solve this with a Regex
echo preg_replace_callback("#(\d+)(,\\1)+#",function($m){if(($c=substr_count($m[0],$m[1]))%2)$r=$m[1];$r.=str_repeat(",".$m[1]*2,$c/2);return trim($r,",");},join(",",$_GET[a]));

You cannot use sort as the result is not always sorted : [4, 4, 2, 8, 8, 2] -> [8, 2, 16, 2]

@Crypto You are right after the new test cases has been added. Before the use of sort was okay

for($i=count($a=$argv);--$i;)$b[]=($a[$i]==$a[$i-1])?2*$a[$i--]:$a[$i];print_r(array_reverse($b)); same idea but shorter

@Crypto I'm not sure about the output as string representation or an array. for the testcase [] I need $r=[]; Thank You for your help

GNU sed, 41 38 37
Includes +1 for -r
-3 Thanks to Digital Trauma
-1 Thanks to seshoumara
:
s,(.*)(1+) \2\b,\1!\2\2!,
t
y,!, ,

Input and output are space separated strings in unary (based on this consensus).
Try it online!

Use y,!, , to save 1 byte.

@seshoumara Duh... Why didn't I think of that. Thanks!

Python, 61 bytes
def f(l):b=l[-2:-1]==l[-1:];return l and f(l[:~b])+[l[-1]<<b]

The Boolean b checks whether the last two elements should collapse by checking that they are equal in a way that's safe for lists of length 1 or 0. The last element if then appended with a multiplier of 1 for equal or 2 for unequal. It's appended to the recursive result on the list with that many elements chopped off the end. Thanks to Dennis for 1 byte!

[l[-1]<<b] saves a byte.

l[-2:-1] is [l[-2]]

I need it to work for lists of size 0 and 1.

57 bytes using 3.8 assignment expressions and a lambda https://tio.run/##FcaxCoAgEADQX3FU0iFzkEO/RG5QRAouE3Fp6dcN3/TaO86nHrb1OYuneKccGQGxWDMrnAJ8PIGnoDSoHf3aDihQbGEVnUs4W7/q4IUHI43U0kqLQswf

Retina, 32
\d+
$*
r`\b\1 (1+)\b
$1$1
1+
$.&

r on line 3 activates right-to-left regex matching.  And this means that the \1 reference needs to come before the (1+) capturing group that it references.
Try it online.

Nice.. That right-to-left option to match is quite handy! Is it part of .Net regex or a Retina feature?

I was just about to post mine at 26, using linefeed-separation as the input format: http://retina.tryitonline.net/#code=JShTYCwKLisKJCoKVHJtYMK2YGBeXDHCtigxKykkCiVNYDEKwrYKLA&input=MiwyLDIKMiwyLDQsNAoyLDIsMiw0LDQsOAoyLDIsMiwy the main savings come from that and using transliteration to get rid of the second substitution.

@Dada It's a .NET feature (and it's used under the hood to enable arbitrary-length lookbehinds). Retina has no unique regex features yet (although it has some unique substitution features).

@MartinEnder Ok thanks! .NET regex's are really great! jealous perl coder spotted

@MartinEnder I your solution is different enough to warrant another answer

@DigitalTrauma it's completely the same apart from that one byte saved with the transliteration stage :)

@Dada hey at least you've got recursion/subroutines ;)

@MartinEnder yea, there is that... I feel like a combination of .NET and perl could be so great!

Perl, 41 bytes
Includes +1 for -p
Give input sequence on STDIN:
shift2048.pl <<< "2 2 2 4 4 8 2"

shift2048.pl:
#!/usr/bin/perl -p
s/.*\K\b(\d+) \1\b/2*$1.A/e&&redo;y/A//d

JavaScript (ES6), 68 bytes

f=a=>a.reduceRight((p,c)=>(t=p[0],p.splice(0,c==t,c==t?c+t:c),p),[])

console.log([
  [],
  [2, 2, 4, 4],
  [2, 2, 2, 4, 4, 8],
  [2, 2, 2, 2],
  [4, 4, 2, 8, 8, 2],
  [1024, 1024, 512, 512, 256, 256],
  [3, 3, 3, 1, 1, 7, 5, 5, 5, 5],
].map(f))

Not bad, but according to the executed snippet: [1024, 1024, 512, 512, 256, 256] is resolving as [2048, 512, 1024] and not [2048, 1024, 512]...?

Perl, 43 + 1 (-p) = 44 bytes
Ton Hospel came up with 41 bytes answer, check it out!
 -4 thanks to @Ton Hospel!
Edit : added \b, as without it it was failing on input like 24 4 on which the output would have been 28.
$_=reverse reverse=~s/(\b\d+) \1\b/$1*2/rge

Run with -p flag :
perl -pe '$_=reverse reverse=~s/(\b\d+) \1\b/$1*2/rge' <<< "2 2 2 4 4"

I don't see another way than using reverse twice to right-fold (as just s/(\d+) \1/$1*2/ge would left-fold, i.e 2 2 2 would become 4 2 instead of 2 4). So 14 bytes lost thanks to reverse... Still I think there must be another (better) way (it's perl after all!), let me know if you find it!

reverse reverse seems a bit lengthy. I'm no expert in Perl, but is there a way you can make a shortcut to reverse (if nothing else, [ab]using eval)?

Nice sexeger. Notice you can just leave out the ($_)

@TonHospel thanks. Indeed, the doc of reverse looks like reverse can't be called without argument (well the examples show it can be, but there is only one prototype : reverse LIST), so I forgot about $_ being the default argument ;)

A LIST can be  empty...

@TonHospel indeed, but usually when an operator uses $_ as default argument, the doc specifies a prototype with no parameters (like print or lenght...). Or maybe that's just an wrong impression I have.

JavaScript (ES6),  68...64  58 bytes
a=>(g=p=>(x=a.pop())|p?p?[...g(p^x?x:!(p*=2)),p]:g(x):a)()

Try it online!
Commented
a => (                  // a[] = input array
  g = p =>              // g is a recursive function taking p = previous value
    (x = a.pop())       //   extract the last entry x from a[]
    | p ?               //   if either x or p is a positive integer:
      p ?               //     if p is a positive integer:
        [               //       update the output:
          ...g(         //         do a recursive call:
            p ^ x ?     //           if p is not equal to x:
              x         //             set new_p = x
            :           //           else:
              !(p *= 2) //             double p and set new_p = false
          ),            //         end of recursive call
          p             //         append p
        ]               //       end of output update
      :                 //     else:
        g(x)            //       do a simple recursive call with new_p = x
    :                   //   else:
      a                 //     stop recursion and return a[], which is guaranteed
                        //     to be an empty array at this point
)()                     // initial call to g with p undefined

I was about to suggest the edit you just made :)

a=>(a.reverse()+'').replace(/(.),\1/g,(c,i)=>i*2).split`,`.reverse()?

@l4m2 That does work for single-digit inputs, but would fail on [1024, 1024, 512, 512, 256, 256] (I think this test case may have been added later).

@Arnauld Well yours also fail ...

f=(a,l=[],m)=>(x=a.pop())*!m-l?f(a,x).concat(l):x?f(a,2*x,1):[l]?

or f=(a,l=[],m)=>m|(x=a.pop())-l?f(a,x).concat(l):x?f(a,2*x,1):[l]

Perl 5.10, 61 50 bytes (49 + 1 for flag)
Thanks to Ton Hospel for saving 11 bytes!
Regex-free solution, with -a flag:
@a=($F[-1]-$b?$b:2*pop@F,@a)while$b=pop@F;say"@a"

Try here!

Nice alternative method. A pity arrays almost always lose to strings in perl. Still, you can get a bit closer by golfing your code to @a=($F[-1]-$b?$b:2*pop@F,@a)while$b=pop@F;say"@a" (50 bytes)

@TonHospel Indeed, I tend to avoid string-based solutions (just to show that Perl can do more than that!). I don't play to win anyway :D Thanks for the golfing tips!

05AB1E, 26 bytes
D¥__X¸«DgL*ê¥X¸«£vy2ôO})í˜

Try it online!
Generalized steps

Reduce by subtraction to find where consecutive elements differ
Reduce by subtraction over the indices of those places to find the length of consecutive elements
Split input into chunks of those lengths
Split chunks into pairs
Sum each pair
Reverse each summed chunk
Flatten to 1-dimensional list

DgL can be ā for -2.

Java 7, 133 bytes
Object f(java.util.ArrayList<Long>a){for(int i=a.size();i-->1;)if(a.get(i)==a.get(i-1)){a.remove(i--);a.set(i,a.get(i)*2);}return a;}

Input is an ArrayList, and it just loops backwards, removing and doubling where necessary.
Object f(java.util.ArrayList<Long>a){
    for(int i=a.size();i-->1;)
        if(a.get(i)==a.get(i-1)){
            a.remove(i--);
            a.set(i,a.get(i)*2);
        }
    return a;
}

You're comparing Long references on line 3 with ==. Consider a.get(i)-a.get(i-1)==0.

Mathematica, 53 bytes
Join@@(Reverse[Plus@@@#~Partition~UpTo@2]&/@Split@#)&

Explanation
Split@#

Split the input into sublists consisting of runs of identical elements. i.e. {2, 2, 2, 4, 8, 8} becomes {{2, 2, 2}, {4}, {8, 8}}.
#~Partition~UpTo@2

Partition each of the sublist into partitions length at most 2. i.e. {{2, 2, 2}, {4}, {8, 8}} becomes {{{2, 2}, {2}}, {{4}}, {{8, 8}}}.
Plus@@@

Total each partition. i.e. {{{2, 2}, {2}}, {{4}}, {{8, 8}}} becomes {{4, 2}, {4}, {16}}.
Reverse

Reverse the results because Mathematica's Partition command goes from left to right, but we want the partitions to be in other direction. i.e. {{4, 2}, {4}, {16}} becomes {{2, 4}, {4}, {16}}.
Join@@

Flatten the result. i.e. {{2, 4}, {4}, {16}} becomes {2, 4, 4, 16}.

Hi JHM! Thanks for the answer. I don't understand Mathematica very well, so could you add a bit of explanation as to what's going on?

Plus@@@ is Tr/@ and I think you can avoid the parentheses and Join@@ if you use ##&@@ on the result of Reverse (haven't tested it though).

Haskell, 56 bytes
g(a:b:r)|a==b=a+b:g r|l<-b:r=a:g l
g x=x
r=reverse
r.g.r

Perl, 37 bytes
Includes +4 for -0n
Run with the input as separate lines on STDIN:
perl -M5.010 shift2048.pl
2
2
2
4
4
8
2
^D

shift2048.pl:
#!/usr/bin/perl -0n
s/\b(\d+
)(\1|)$//&&do$0|say$1+$2

PHP, 86 100 99 94 bytes
for($r=[];$v=+($p=array_pop)($a=&$argv);)array_unshift($r,end($a)-$v?$v:2*$p($a));print_r($r);

requires PHP 7.0; takes values from command line arguments.
Run with -nr or try it online.

[2, 2, 2] returns [4,2] instead of [2,4]

for($r=[];$v=($p=array_pop)($a=&$_GET[a]);)array_unshift($r,end($a)-$v?$v:2*$p($a));print_r($r); is 1 Byte shorter

Javascript - 103 bytes
v=a=>{l=a.length-1;for(i=0;i<l;i++)a[l-i]==a[l-1-i]?(a[l-i-1]=a[l-i]*2,a.splice(l-i,1)):a=a;return a}

Saved 16 bytes thanks to @MayorMonty tips on this page

This doesn't work. Testing with [2,2,4,4] yields [2,2,4,4].

yup. Node v6.2.1

Julia 205 bytes
t(x)=Val{x}
s(x)=t(x)()
f^::t(1)=f
^{y}(f,::t(y))=x->f(((f^s(y-1))(x)))
g()=[]
g{a}(::t(a))=[a]
g{a}(::t(a),B...)=[a;g(B...)]
g{a}(::t(a),::t(a),B...)=[2a;g(B...)]
K(A)=g(s.(A)...)
H(A)=(K^s(length(A)))(A)

Function to be called is H
eg H([1,2,2,4,8,2,])
This is in no way the shortest way do this in julia.
But it is so cool, that I wanted to share it anyway.

t(a) is a value-type, representing the value (a).
s(a) is an instance of that value type
g is a function that dispatches on the difference values (using the value types) and numbers of its parameters. And that is cool
K just wraps g so that

Extra cool part:
f^::t(1)=f
^{y}(f,::t(y))=x->f(((f^s(y-1))(x)))

This defines the ^ operator to apply to functions.
So that K^s(2)(X) is same as K(K(X))
so H is just calling K on K a bunch of times -- enough times to certainly collapse any nested case
This can be done much much shorter, but this way is just so fun.

PowerShell v2+, 81 bytes
param($n)($b=$n[$n.count..0]-join','-replace'(\d+),\1','($1*2)'|iex)[$b.count..0]

Takes input as an explicit array $n, reverses it $n[$n.count..0], -joins the elements together with a comma, then regex -replaces a matching digit pair with the first element, a *2, and surrounded in parens. Pipes that result (which for input @(2,2,4,4) will look like (4*2),(2*2)) over to iex (short for Invoke-Expression and similar to eval), which converts the multiplication into actual numbers. Stores the resulting array into $b, encapsulates that in parens to place it on the pipeline, then reverses $b with [$b.count..0]. Leaves the resulting elements on the pipeline, and output is implicit.

Test Cases
NB-- In PowerShell, the concept of "returning" an empty array is meaningless -- it's converted to $null as soon as it leaves scope -- and so it is the equivalent of returning nothing, which is what is done here in the first example (after some wickedly verbose errors). Additionally, the output here is space-separated, as that's the default separator for stringified arrays.
PS C:\Tools\Scripts\golfing> @(),@(2,2,4,4),@(2,2,2,4,4,8),@(2,2,2,2),@(4,4,2,8,8,2),@(1024,1024,512,512,256,256),@(3,3,3,1,1,7,5,5,5,5)|%{"$_ --> "+(.\2048-like-array-shift.ps1 $_)}
Invoke-Expression : Cannot bind argument to parameter 'Command' because it is an empty string.
At C:\Tools\Scripts\golfing\2048-like-array-shift.ps1:7 char:67
+   param($n)($b=$n[$n.count..0]-join','-replace'(\d+),\1','($1*2)'|iex)[$b.count. ...
+                                                                   ~~~
    + CategoryInfo          : InvalidData: (:String) [Invoke-Expression], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationErrorEmptyStringNotAllowed,Microsoft.PowerShell.Commands.InvokeExpressionCommand

Cannot index into a null array.
At C:\Tools\Scripts\golfing\2048-like-array-shift.ps1:7 char:13
+   param($n)($b=$n[$n.count..0]-join','-replace'(\d+),\1','($1*2)'|iex)[$b.count. ...
+             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : NullArray

 -->
2 2 4 4 --> 4 8
2 2 2 4 4 8 --> 2 4 8 8
2 2 2 2 --> 4 4
4 4 2 8 8 2 --> 8 2 16 2
1024 1024 512 512 256 256 --> 2048 1024 512
3 3 3 1 1 7 5 5 5 5 --> 3 6 2 7 10 10

Brain-Flak, 60 bytes
{({}<>)<>}<>{(({}<>)<>[({})]){((<{}>))}{}{({}<>{})(<>)}{}}<>

Try it online!
Explanation:
{({}<>)<>}<>   Reverse stack

{   While input exists
  (
    ({}<>)   Push copy of last element to the other stack
    <>[({})] And subtract a copy of the next element
  )   Push the difference
  {   If the difference is not 0
    ((<{}>)) Push two zeroes
  }{}  Pop a zero
  {   If the next element is not zero, i.e the identical element
    ({}<>{})  Add the element to the copy of the previous element
    (<>)      Push a zero
  }{}    Pop the zero
}<>  End loop and switch to output stack

APL (Dyalog Unicode), 20 bytes
⌽1⊥¨⌽⊂⍨2|⌽(⊥⍨=)¨,\∘⌽

Try it online!
Fully tacit version of the previous solution, thanks to Adám.
How it works
⌽1⊥¨⌽⊂⍨2|⌽(⊥⍨=)¨,\∘⌽  ⍝ Right argument: V, vector to reduce by 2048 rules
                   ⌽  ⍝ Reverse V to get RV
                ,\∘   ⍝ Prefixes of RV
         ⌽(  =)¨      ⍝ For each prefix, test if each element equals last element
           ⊥⍨         ⍝   and count trailing ones
                      ⍝   (one-based index of each item within runs)
       2|             ⍝ Modulo 2
    ⌽⊂⍨               ⍝ Partition RV at ones of the above
 1⊥¨                  ⍝ Sum of each chunk
⌽                     ⍝ Reverse back

APL (Dyalog Unicode), 26 bytes
⌽+/¨{⍵⊂⍨2|{⊥⍨⍵=⊃⌽⍵}¨,\⍵}⌽⎕

Try it online!
A full program. Link is to function version for easier testing.
How it works
⌽+/¨{⍵⊂⍨2|{⊥⍨⍵=⊃⌽⍵}¨,\⍵}⌽⎕
                         ⎕  ⍝ Take input
                        ⌽   ⍝ Reverse
    {                  }    ⍝ Apply the anonymous function...
                    ,\⍵     ⍝   Prefixes
          {       }¨        ⍝   For each prefix,
             ⍵=⊃⌽⍵          ⍝     Evaluate if each element is equal to last
           ⊥⍨               ⍝     and count trailing ones
                            ⍝     (one-based index of each item within runs)
        2|                  ⍝   Take modulo 2
     ⍵⊂⍨                    ⍝   Partition the input array at 1's of the above
 +/¨                        ⍝ Sum each group
⌽                           ⍝ Reverse back

Go all tacit for 20: ⌽1⊥¨⌽⊂⍨2|⌽(⊥⍨=)¨,\∘⌽

i couldn't beat the above but i thought this might be worth sharing: ∊{⍺∊⍵:⊂⍺0+⍵⋄⍺⍵}/⎕,⊂⍬ - a 20 using a completely different approach

Racket 166 bytes
(λ(l)(let g((l(reverse l))(o '()))(cond[(null? l)o][(=(length l)1)(cons(car l)o)]
[(=(car l)(second l))(g(drop l 2)(cons(* 2(car l))o))][(g(cdr l)(cons(car l)o))])))

Ungolfed:
(define f
  (λ (lst)
    (let loop ((lst (reverse lst))
               (nl '()))
      (cond                            ; conditions:
        [(null? lst)                   ; original list empty, return new list;
               nl]
        [(= (length lst) 1)            ; single item left, add it to new list
              (cons (first lst) nl)]
        [(= (first lst) (second lst))  ; first & second items equal, add double to new list
              (loop (drop lst 2)
                    (cons (* 2 (first lst)) nl))]
        [else                          ; else just move first item to new list
              (loop (drop lst 1)
                    (cons (first lst) nl))]
        ))))

Testing:
(f '[])
(f '[2 2 4 4])
(f '[2 2 2 4 4 8])
(f '[2 2 2 2])
(f '[4 4 2 8 8 2])
(f '[1024 1024 512 512 256 256])
(f '[3 3 3 1 1 7 5 5 5 5])
(f '[3 3 3 1 1 7 5 5 5 5 5])

Output:
'()
'(4 8)
'(2 4 8 8)
'(4 4)
'(8 2 16 2)
'(2048 1024 512)
'(3 6 2 7 10 10)
'(3 6 2 7 5 10 10)

Python 2, 94 bytes
def f(a,r=[]):
 while a:
    if len(a)>1and a[-1]==a[-2]:a.pop();a[-1]*=2
    r=[a.pop()]+r
 print r

Try it online

Julia 0.6, 73 82 Bytes
f(l)=l==[]?[]:foldr((x,y)->y[]==x?vcat(2x,y[2:end]):vcat(x,y),[l[end]],l[1:end-1])

Try it online!
Use right fold to build list from back to front (one could also use fold left and reverse the list at the beginning and end).
If the head of the current list is not equal to the next element to prepend, then just prepend it.
Else remove the head of the list (sounds kind of cruel) and prepend the element times 2.
Example
f([3,3,3,1,1,7,5,5,5,5])
returns a new list:
[3,6,2,7,10,10]

[1024,1024,512,512,256,256] returns [2048,512,1024] instead of [2048,1024,512]

Mathematica, 51 bytes
Abs[#//.{Longest@a___,x_/;x>0,x_,b___}:>{a,-2x,b}]&

{Longest@a___,x_/;x>0,x_,b___} matches a list containing two consecutive identical positive numbers and transform these two numbers into -2x. Longest forces the matches to happen as late as possible.
The process is illustrated step by step:
   {3, 3, 3, 1, 1, 7, 5, 5, 5, 5}
-> {3, 3, 3, 1, 1, 7, 5, 5, -10}
-> {3, 3, 3, 1, 1, 7, -10, -10}
-> {3, 3, 3, -2, 7, -10, -10}
-> {3, -6, -2, 7, -10, -10}
-> {3, 6, 2, 7, 10, 10}

Japt, 12 bytes
ò¦ ®ò2n)mxÃc

Try it online!
Unpacked & How it works
Uò!= mZ{Zò2n)mx} c

Uò!=    Partition the input array where two adjacent values are different
        i.e. Split into arrays of equal values
mZ{     Map the following function...
Zò2n)     Split into arrays of length 2, counting from the end
          e.g. [2,2,2,2,2] => [[2], [2,2], [2,2]]
mx        Map `Array.sum` over it
}
c       Flatten the result

Got some idea from Jonathan Allan's Jelly solution.

10 bytes

Common Lisp, 143 bytes
(defun e(l)(if(<(length l)1)'()(if(eq(car l)(cadr l))(cons(*(car l)2)(e(cddr l)))(cons(car l)(e(cdr l))))))
(defun f(l)(reverse(e(reverse l))))

Try it online!

APL (Dyalog Unicode), 34 bytesSBCS
Anonymous prefix lambda.
{∊((⊃⍴⍨2|≢),+⍨⍴⍨∘⌊2÷⍨≢)¨⍵⊂⍨2≠/0,⍵}

Try it online!
{…} dfn; ⍵ is right argument
 0,⍵ prepend a zero to the argument
 2≠/ pairwise inequality mask
 ⍵⊂⍨ use that to partition (true means begin new partition here) the argument
 (…)¨ apply the following tacit function to each run of equal numbers:
  ≢ the length of the run
  2÷⍨ let 2 divide that
  ⌊ floor that
  ∘ then
  ⍴⍨ use it to reshape…
  +⍨ the doubled (lit. addition selfie) run
  (…), append that to the following:
   ≢ the length of the run
   2| division remainder when divided by two (1 for odd length runs, 0 for even length runs)
   ⊃⍴⍨ use that to reshape the first element of the run
 ∊ enlist (flatten)

Python 3, 100 73 71 bytes
Thanks to @jo-king -27 bytes! and @jakque -2 bytes
n=lambda l:l[1:]and[*n(l[:~(l[-1]==l[-2])]),l[-1]*-~(l[-1]==l[-2])]or l

Try it online!

71 bytes :Try it online!

05AB1E (legacy), 8 7 bytes
γ2δôOí˜

-1 byte thanks to @ovs.
Try it online or verify all test cases.
Explanation:
γ        # Split the (implicit) input into chunks of equal adjacent values
         #  i.e. [4,4,2,8,8,8,2] → [[4,4],[2],[8,8,8],[2]]
  δ      # Map each to:
 2 ô     #  Split it into parts of size 2
         #   → [[[4,4]],[[2]],[[8,8],[8]],[[2]]]
    O    # Take the sum of each
         #  → [[8],[2],[16,8],[2]]
     í   # Reverse each
         #  → [[8],[2],[8,16],[2]]
      ˜  # Flatten everything
         #  → [8,2,8,16,2]
         # (after which the resulting list is output implicitly)

γ2δôOí˜ for 7 bytes. The last two bytes could be `€`` as well

@ovs Thanks. Looks like this one was one my earlier 05AB1E answers where I forgot about δ. :) Nice alternative with €` , though.

@ovs Out of curiosity: how do you put a trailing tilde inside a codeblock within a comment? I know it's possible to have it inside a string with double tildes (i.e. assuming these single quotes are tildes: ''like'this'' -> like`this), but I'm not sure with a leading/trailing tilde. Are you using an unprintable character or something, or you know a way where <code></code> works in comments?

You can escape \`` with a backslash, the source of the above is `€\\`` (<- this needs even more backslashes ;) ). BTW my computer tells me `is a *grave accent*, a tilde is~`.

@ovs Ah, I mixed up tilde and grave accent indeed, mb. And thanks, didn't even knew you could escape them. Makes sense I guess.

Nekomata, 7 bytes
ĉ~ĭ+↔aj

Attempt This Online!
A port of @The Thonnu's Thunno 2 answer.
ĉ~ĭ+↔aj
ĉ           Split the input into runs of identical items
 ~   a      For each run:
  ĭ             Deinterleave
   +            Add
    ↔           Reverse
      j     Concatenate

Java 8, 130 114 bytes
Edit:

-16 bytes off. Thanks to @Kevin Cruijssen.

Snipet:
s->{int j=0,i=s.length,l[]=new int[i];for(;--i>-1;[j++]=s[i]==s[i-1]?s[i--]*2:s[i]);return Collection.reverse(l);}

Code:
public static int[] shift(int[]a){
  List<int> out = new ArrayList<>();
  for(int i = s.length-1; i>-1;i--){
    if(s[i]==s[i-1]){
      out.add(s[i]*2);
      i--;
    }else{
      out.add(s[i]);
    }
  }
  return Arrays.reverse(out.toArray());
}

Hi, you can golf it some more like this: s->{int j=0,i=s.length,l[]=new int[i];for(;--i>-1;[j++]=s[i]==s[i-1]?s[i--]*2:s[i]);...} Also, Arrays#reverse doesn't exist?.. :S Collections#reverse does, but Arrays not a.f.a.i.k. (And if it did exist, you'd need java.util. in front of it.)

This code is not fully representational of the full code required to run it, nor is it capable of running as-is.

I wrote Snipet not full programm and this declares a function object as the OP said: The task is to write a function [...]

I can't get either version of your code to compile in Java 8. Additionally, it looks to me like your golfed code returns an array of the original size, not the newly modified size.

Vim, 28 bytes
G@='?\v(\d+)\n\1<C-@>DJ@"<C-A>-@=<C-@>'<CR>
A macro that regex searches backward for matching consecutive numbers, and adds them together.
The input array needs to be one number per line. This format saves me strokes, which is nice, but the real reason is to work around overlapping regex matches. Given the string 222, if you /22 you'll match only the first pair, not the overlapping second pair. The overlap rules are different when the two pairs start on different lines. In this challenge [2, 2, 2] becomes [2, 4], so matching the overlapping pair is critical.
NOTE: The challenge asked for only a single pass. For that reason, you need to have :set nowrapscan. With :set wrapscan I could make a version that finishes the job on multiple passes, though this solution as written won't always do that.

<C-@>: Normally, in a command line, to type a literal <CR> without running the command you'd have to escape it with <C-V>. But you can type <C-@> unescaped and it will be treated as a <C-J>/<NL>, which will be like <CR> when you run the macro but not when you're typing. Try reading :help NL-used-for-Nul.
@=: I can't use a recorded macro easily this time because there's a possibility the input might have no matching pairs. If that happens while running a macro, the unsuccessful search will fail the macro. But if it happens during the (implicit first) recording pass, the rest of the normal mode commands will run, damaging the file. The downside of @= is I lose a byte on the recursive call; sometimes you can use @@ as a recursive call, but that would run @" from 4 bytes earlier in this case.
DJ@"<C-A>-: DJ deletes the line and puts the number (no newline) in a register, so I can run it as a macro for a number argument to <C-A>. I have to - afterward so I don't get a second match in cases like [4, 2, 2].

Perl6, 92 bytes
{my @b;loop ($_=@^a-1;$_>=0;--$_) {@b.unshift($_&&@a[$_]==@a[$_-1]??2*@a[$_--]!!@a[$_])};@b}

Prolog (SWI), 97 87 bytes
[N,N|T]+[O|Q]:-O is N*2,T+Q.
[N|T]+[N|Q]:-T+Q.
R+R.
L-R:-reverse(L,M),M+Q,reverse(Q,R).

Try it online!

Ruby, 55 bytes
->a{c=[];c=[(b=a.pop)==a[-1]?a.pop*2:b]+c while a[0];c}

Try it online!
So long and still no Ruby answer? It can't be.
More golfing will follow.

C (GCC), 87 bytes
I'm not very familiar with the allowed I/O methods for C, but I think this is valid. The function takes an input array a (int *) and length l and two empty parameters r and w (int). The output is stored to the right portion of the input array, and the new length is returned.
f(a,l,r,w)int*a;{for(r=w=l;r--;)a[--w]=r<1|a[r]-a[r-1]?a[r]:a[r--]*2;return!!~l*~w-~l;}

Try It Online
The program may read at index -1 in the input array, which seems to work fine in my test program. Valgrind reports this access in some cases, but I was unable to get this to crash the program with global, automatic, or malloced input arrays on my system.
Acknowledgments

-6 bytes thanks to ceilingcat

Powershell, 73 71 bytes
for($r=@();$z=$args[--$i]){$i-=$e=$z-eq$args[$i-1]
$r=,($z+$z*$e)+$r}$r

Less golfed test script:
$f = {

$r=@()                      # result
for(;$z=$args[--$i]){       # all elements from end to start
    $e=$z-eq$args[$i-1]     # current is $equal to previous
    $i-=$e                  # shift if need
    $r=,($z+$z*$e)+$r       # insert to start
}
$r                          # output result

}

@(
    ,( @()  ,  @() )
    ,( (2, 2, 4, 4)  , (4, 8) )
    ,( (2, 2, 2, 4, 4, 8)  , (2, 4, 8, 8) )
    ,( (2, 2, 2, 2)  , (4, 4) )
    ,( (4, 4, 2, 8, 8, 2)  , (8, 2, 16, 2) )
    ,( (1024, 1024, 512, 512, 256, 256)  , (2048, 1024, 512) )
    ,( (3, 3, 3, 1, 1, 7, 5, 5, 5, 5)  , (3, 6, 2, 7, 10, 10) )
) | % {
    $arr,$expected = $_
    $result = &$f @arr     # splatting
    "$("$result"-eq"$expected"): $result"
}

Output:
True:
True: 4 8
True: 2 4 8 8
True: 4 4
True: 8 2 16 2
True: 2048 1024 512
True: 3 6 2 7 10 10

Pushy, 18 bytes
$L1=?v;2d=?+;v;O@_

Try it online!
$                     \ While there are items left on input stack:
 L1=?                 \  if len(input) == 1:
     v;               \    move the final remaining item to output stack
                      \  else:
       2d             \    copy the last two items
         =?           \    if equal:
           +;         \      add together
             v;       \    move the last item on stack to output stack
               O@_    \ Print the output stack (reversed)

Lua 5.3, 117 113 bytes
function f(t)i,o=#t,{}while i>0 do v=t[i]if v==t[i-1]then v=v*2i=i-1 end i=i-1table.insert(o,1,v)end return o end

Try it online!
I think Lua 5.1 would require an extra byte because a number has to be separated from an identifier: v=v*2i=i-1 → v=v*2 i=i-1.

113 bytes through some rearranging

Excellent! Updated post.

C# (Visual C# Interactive Compiler), 72 bytes
x=>{for(int i=x.Count-1;i>0;)if(x[i--]==x[i]){x.RemoveAt(i);x[i--]*=2;}}

Try it online!
This function outputs by modifying an argument.
Credit to @ASCIIOnly for suggesting that I not create a new list. That suggestion led me to discover the above referenced rule. Total savings of 22 bytes without creating a new list and by removing the return statement :)
Less golfed...
// x is an input List
x=>{
  // iterate from back to front
  for(int i=x.Count-1;i>0;)
    // check for consecutive elements
    if(x[i--]==x[i]){
      // remove the first occurrence
      x.RemoveAt(i);
      // double the second occurrence
      // which has been shifted
      x[i--]*=2;
    }
}

why not this

I see... You are forcing the type to be a proper List vs IList. It seemed a little strange to be mangling the input and returning the same object, but I guess that doesn't matter as much w/ code golf :) Almost seems like you'd want to use Action<List> and don't return anything?

Well... they do say "returns a shifted array". Plus, solutions of many languages are modifying the array simply because it is so insanely expensive to duplicate it

@ASCIIOnly - looks like modifying the input might suffice. https://codegolf.meta.stackexchange.com/a/4942/8340

Oh, huh, TIL. I guess it's just that it's not too often that modifying input is shorter

Yeah - I'm still pretty green here :) Lots of rules to learn, but at least there seems to be a pretty history to see what's been decided upon in the past.

F# (.NET Core), 87 bytes
fun x->(List.foldBack(fun e (h::t)->if h=e then 0::e*2::t.Tail else e::e::t)x [0]).Tail

Try it online!
Uses the List.foldBack function to process the input from back to front. The head of the working list contains an element that can be merged, or a 0 to indicate the previous element cannot be merged

Husk, 8 bytes
ṁȯ↔mΣC2g

Try it online!
ṁ is a lifesaver here.

Julia 1.0, 69 bytes
x\y=x!==y[1] ? Int[x;y] : [2.0x;[y;][2:end]]
!l=l>[] ? foldr(\,l) : l

Try it online!
when 2 numbers are merged, they are turned into a float, so that it won't be === to the next number, which is an integer. When there is no merge, the numbers are converted back to integers to re-allow merging numbers
based on this answer
Julia 0.6, 61 bytes
x\y=x!==y[]?Int[x;y]:[2.0x;[y;][2:end]]
!l=l!=[]?foldr(\,l):l

Try it online!

Java (JDK), 114 112 bytes
n->{List l=new Stack();for(int i=n.length;i-->1;)if(n[i]>0)l.add(n[i]==n[i-1]?n[i]*2+(n[i-1]=0):n[i]);return l;}

Try it online!
Returns the list in reverse.
-2 Thanks to celingcat.

Japt, 9 bytes
òÎc_ò Ômx

Try it or run all test cases
òÎc_ò Ômx     :Implicit input of array
ò             :Partition between elements where
 Î            :  The sign of their difference is truthy (not 0)
  c           :Map then flatten
   _          :By passing each array through the following function
    ò         :  Partitions of length 2
      Ô       :  Reverse
       m      :  Map
        x     :    Reduce by addition

Arturo, 57 bytes
$=>[chunk&=>[&]|map=>[map&++0[x y]->x+y|reverse]|flatten]

Try it!
$=>[                     ; a function where input is assigned to &
    chunk&=>[&]          ; split input into lists of equal contiguous elements
    |map=>[              ; then map each list to...
        map              ; map over...
        &++0             ; ...input list with 0 appended
        [x y]->          ; in pairs; assign elements to x and y
            x+y          ; add the pair
        |reverse         ; then reverse the list
    ]                    ; end map
    |flatten             ; then flatten the result
]                        ; end function

Thunno 2 S, 6 bytes
ġı2ẇʂr

Attempt This Online!
Inspired by Jonathan Allan's Jelly answer.
Explanation
ġı2ẇʂr  # Implicit input              [2, 2, 2, 4, 4, 8]
ġ       # Group consecutive items     [[2, 2, 2], [4, 4], [8]]
 ı      # Map:                        [2, 2, 2]       [4, 4]     [8]
  2ẇ    #  Split into pairs           [[2, 2], [2]]   [[4, 4]]   [[8]]
    ʂ   #  Sum each inner list        [4, 2]          [8]        [8]
     r  #  Reverse                    [2, 4]          [8]        [8]
        # End map                     [[2, 4], [8], [8]]
        # Implicit output, flattened  [2, 4, 8, 8]

Vyxal d, 43 bitsv2, 5.375 bytes
Ġƛy+ṘC

Try it Online!
Outputs as characters representing each value, as in this meta consensus.
-5 bits thanks to @alephalpha
Explained
Ġƛy+ṘC
Ġƛ      # To each consecutive group of values:
  y+    #   Uninterleave the group and add the two halves
    Ṙ   #   Reverse
     C  #   Convert to character
# The d flag flattens then sums the result

 Created with the help of Luminespire at https://vyxal.github.io/Luminespire

½ byte: 2ẇṠ -> y+

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/


text:
Folding Numbers
Given a number determine if it is a folding number.
A folding number is a number such that if you take it binary representation and "fold" it in half,  That is take the result of XNOR multiplication of the first half of the number and the second half with it digits in reverse, you will get zero.
If the number has a odd number of digits in binary its middle digit must be 1 and is ignored when folding.
Since that might be a bit confusing I will give some examples:
178
The binary representation of 178 is
10110010

To fold this we first split it in half
1011 0010

We reverse the second half
1011
0100

And we XNOR the two halves:
0000

This is zero so this is a folding number.
1644
The binary representation of 1644 is
11001101100

To fold this we first split it in half
11001 1 01100

The middle bit is 1 so we throw it out.
11001 01100

We reverse the second half
11001
00110

And we XNOR the two halves:
00000

This is zero so this is a folding number.
4254
The binary representation of 4254 is
1000010011110

To fold this we first split it in half
100001 0 011110

The middle bit is 0 so this is not a folding number.
Task
Your task is to take in a positive number and return a truthy if the number is folding and falsy if it is not.  This is code golf so try to keep the byte count down.
Test Cases
Here are the first 99 folding numbers:
[1, 2, 6, 10, 12, 22, 28, 38, 42, 52, 56, 78, 90, 108, 120, 142, 150, 170, 178, 204, 212, 232, 240, 286, 310, 346, 370, 412, 436, 472, 496, 542, 558, 598, 614, 666, 682, 722, 738, 796, 812, 852, 868, 920, 936, 976, 992, 1086, 1134, 1206, 1254, 1338, 1386, 1458, 1506, 1596, 1644, 1716, 1764, 1848, 1896, 1968, 2016, 2110, 2142, 2222, 2254, 2358, 2390, 2470, 2502, 2618, 2650, 2730, 2762, 2866, 2898, 2978, 3010, 3132, 3164, 3244, 3276, 3380, 3412, 3492, 3524, 3640, 3672, 3752, 3784, 3888, 3920, 4000, 4032, 4222, 4318, 4462, 4558]

Is 4 not a folding number?

@Adnan The middle bit is 0, so no. (It might be worth having a third worked example like this though.) Same goes for 18.

@MartinEnder Ahh, I missed that part. Thanks :)

@Adnan Whoops. Mobile :-)

why does the middle number have to be one (in odd digit binary #s)?  was that arbitrary or was there a reason?

@timrxd if you try to fold a number by adding up opposite digits, a number with a one in the center you will get a string of all ones. If it has a zero in the center you will end with a zero in the result.

I know you gave one example of non-folding but if all your test cases are folding numbers then return true would pass. You should have at least three negative test cases, one with 0 in the middle, one with 1 in the middle, and one with an even number of bits.

Isn't bitwise XNOR just AND?

@CedricReichenbach No, it's not. XNOR is the NOT of the XOR. It is pretty much an AND except 0 XNOR 0 returns 1.

Jelly, 9 bytes
Bœs2µḢ^UȦ

Try it online! or verify all test cases.
How it works
Bœs2µḢ^UȦ  Main link. Argument: n

B          Binary; convert n to base 2.
 œs2       Evenly split 2; split the base 2 array into chunks of equal-ish length.
           For an odd amount of digits, the middle digit will form part of the
           first chunk.
    µ      Begin a new, monadic chain. Argument: [A, B] (first and second half)
     Ḣ     Head; remove and yield A.
       U   Upend; reverse the digits in [B].
      ^    Perform vectorized bitwise XOR of the results to both sides.
           If A is longer than B, the last digit will remain untouched.
           n is a folding number iff the result contains only 1's.
        Ȧ  Octave-style all; yield 1 iff the result does not contain a 0.

Pretty sure I tried that, oh well :)

Python 2, 57 bytes
s=bin(input())[2:]
while''<s!='1':s[-1]==s[0]<_;s=s[1:-1]

Outputs via exit code: error for Falsey, and no error for Truthy.
Converts the input into binary. Checks whether the first and last character are unequal, keeps and repeating this after removing those characters.
The comparison s[-1]==s[0]<_ gives an error if the first and last character are unequal by trying to evaluate the unassigned variable named _. If they are equal, the chain of inequalities is short-circuited instead. When we get to the middle element of 1, the while loop is terminate to special-case it as OK.
I suspect a purely arithmetic approach will be shorter with a recursion like f=lambda n,r=0:...f(n/2,2*r+~n%2)... to chomp off binary digits from the end flipped and reversed, and detect when n and r are equal up to a center 1. There are subtleties though with leading zeroes and the center.

Java 7, 152 145 142 138 134 bytes
boolean f(Long a){byte[]b=a.toString(a,2).getBytes();int i=0,l=b.length,z=l%2<1?1:b[l/2]-48;for(;i<l/2;)z*=b[i]-b[l-++i];return z!=0;}

Loops over the string like it would for a palindrome, looking for zeroes. Keeps track by repeatedly multiplying, so all you have to do is check that it's not zero at the end.
Without scroll bars:
boolean f(Long a){
    byte[]b=a.toString(a,2).getBytes();
    int i=0,l=b.length,z=l%2<1?1:b[l/2]-48;
    for(;i<l/2;)
        z*=b[i]-b[l-++i];
    return z!=0;
}

"but can surely be golfed down" I don't think your current answer can be golfed more, but I'd like to be proven wrong. +1 (PS: Your ungolfed part contains two closing brackets.)

byte[]b=(a+"").getBytes(); is shorter than the char[]b=a.toString(a,2).toCharArray(); and still seems to work (-12 bytes).

@KevinCruijssen That's not a binary string AFAICT, but I think getBytes might still work over the char[]. Thanks :)

@KevinCruijssen Yeah, realized that and removed comment >_<.

@Geobits: Since the method can return any truthy or falsy values, you can just return z as an int (0 for falsy, any other for truthy) - will save you a couple of bytes.

@shooqie I use the meta consensus for truthy, so that won't work in Java.

05AB1E, 13 12 bytes
Code:
bS2ä`R0¸«s^P

Uses the CP-1252 encoding. Try it online!
Explanation:
First, we convert the number to binary using b. 1644 becomes 11001101100. We split this into two pieces with 2ä. For example, 11001101100 would become:
[1, 1, 0, 0, 1, 1]
[0, 1, 1, 0, 0]

If there is an uneven number of bits, the first part will receive the extra bit. We Reverse the last string and append a zero using 0¸«. The reason for this is to only give truthy results when the middle bit is a 1 (1 XOR 0 = 1 and 0 XOR 0 = 0). If there is no middle bit, 05AB1E will just ignore the last bit (the zero that was appended) :
[1, 1, 0, 0, 1, 1]
[0, 0, 1, 1, 0, 0]

The last thing we need to do is do an element-wise XOR and take the product of the result. If there is one element too many, the program will just leave the last element out ([1, 0, 0] XOR [0, 1] = [1, 1]) For example:
[1, 1, 0, 0, 1, 1]
[0, 0, 1, 1, 0, 0] XOR

Becomes:
[1, 1, 1, 1, 1, 1]

And the product of that is 1, which is truthy.

Very nice! Too bad the s is required.

@Emigna Yeah, I should fix that some time. This also gave me some inspiration for other commands :p

Awwh, I was halfway there, trying 05AB1E out for the first time, this one was rather tough. bÐg;ô was as far as I got before refreshing and seeing you nailed it. Great answer, helping me learn!

@carusocomputing Thanks! It's always nice to see new people interested in 05AB1E :). If you have any questions, you can always ask in this chatroom.

Oh crap! This was a different question! I was on the "super folding" question. I tried to extend the answer out to that solution as well, but iterating is even more challenging.

JavaScript (ES6), 61 57 52 bytes
Recursively computes:
(bit(N) XOR bit(0)) AND (bit(N-1) XOR bit(1)) AND (bit(N-2) XOR bit(2)) etc.

where N is the rank of the highest bit set in the input.
If the input has an odd number of bits, the middle bit is XOR'ed with undefined (the value returned by pop() on an empty array), which lets it unchanged. So, a 0 middle bit clears the output and a 1 middle bit doesn't alter the result of the other operations -- which is consistent with the challenge definition of a folding number.

f=(n,[a,...b]=n.toString(2))=>a?(a^b.pop())&f(n,b):1

// testing integers in [1 .. 99]
for(var i = 1; i < 100; i++) {
  f(i) && console.log(i);
}

Nice! Can you explain how this takes the middle bit into account?

@ETHproductions - Sure. I've added a note about that.

Python 2, 94 79 72 67 bytes
F=lambda s:s in'1'or(s[0]!=s[-1])*F(s[1:-1])
lambda n:F(bin(n)[2:])

Saved 12 bytes thanks to @xnor
Defines an unnamed function on the second line.
Explanation (with some whitespace added):
F = lambda s:                                        # We define a function, F, which takes one argument, the string s, which returns the following:
             s in'1'                                 # Gives true if s is '' or s is '1', the first case is a base case and the second is for the middle bit case.
                     or(s[0] != s[-1])               # Or the first and last are different
                                      * F(s[1:-1])   # And check if s, without the first and last element is also foldable.
lambda n: F(bin(n)[:-2])                             # The main function, which calls F with the argument in binary form.

Try it here!

s==''or s=='1' can be s in'1'

Oh so similar - great minds...

The and can be arithmetic *. Also, f is allowed to be unnamed.

Haskell, 89 88 86 bytes
f n|n<2=[n]|1>0=mod n 2:f(div n 2)
g n=elem(product$zipWith(+)(f n)$reverse$f n)[1,2]

Works by summing bitwise the bit representation with its reverse and taking the product. If it's 1 or 2, the number is a folding number (1 if there are even bits that fold, 2 if there are odd bits and a one in the middle).

Python 2, 100 99 95 94 Bytes
This feels a bit long, but I'll keep working at it :) Prints a 1 if the number can be folded, 0 otherwise.
a=bin(input())[2:]
b=len(a)
print(a[b/2]>=`b%2`)*all(c!=d for c,d in zip(a[:b/2],a[:~b/2:-1]))

Test it here!
thanks to Wheat Wizard for the 1-byte save :)
thanks to Rod for the 5-byte save! :)

you can replace b-1 with ~b

@WheatWizard Awesome, thanks!

you can replace [1,a[b]>'0'][len(a)%2] with (a[b]>=\len(a)%2`)`

also you can add e=len(a) to change b=e/2 \e%2\ , saving 1 byte. And then both python answer will be tied c:

@Rod Awesome :D Except now the other answer is crushing me ;)

><>, 37+3 = 40 bytes
<,2-@:%2:v!?:
=2lrv?=1l<+={$r0?
0=n;>

Input is expected to be present on the stack at program start, so +3 bytes for the -v flag.
Try it online!

Jelly, 13 bytes
Bœs2U0¦z0^/€Ạ

TryItOnline
Or matching terms up to 4558
How?
Bœs2U0¦z0^/€Ạ - Main link: n
B             - binary
 œs2          - split into 2 slices (odd length will have first longer than second)
     0¦       - apply to index 0 (the right hand one)
    U         - reverse
       z0     - zip together with filler 0 (thus central 1 or 0 will pair with 0)
          /€  - reduce with for each
         ^    -     XOR
            Ạ - All truthy?

Perl, 46 bytes
Includes +1 for -p
Run with the number on STDIN
folding.pl <<< 178

folding.pl:
#!/usr/bin/perl -p
$_=($_=sprintf"%b",$_)<s%.%!/\G1$/^$&^chop%eg

I consider it a perl bug that this even works. Internal $_ should not be getting match position updates once it is modified. In this program the match position actually moves beyond the end of $_

Nice one. Best I could do is 59 : perl -pe '$_=sprintf("%b",$_)=~/^(.*)1?(??{reverse$^N=~y%01%10%r})$/' :/

Brachylog, 16 bytes
ḃḍ{↔|h1&b↔}ᵗz₂≠ᵐ

It doesn't quite work online...
Takes input through the input variable and outputs through success or failure. It relies heavily on z₂, which has been in the language since April 30, but we forgot to ask to have it pulled on TIO so for the time being this only works on a local installation of the language. Either way it's probably an overly naive approach.
                    The input
ḃ                   's binary representation
 ḍ                  split in half
  {       }ᵗ        with its second half
   ↔|               either reversed, or
     h1             if it starts with 1
       &b           relieved of its first element
         ↔          and then reversed
              ≠     has no duplicate elements
            z  ᵐ    in any pair of elements zipped from the two halves
             ₂      which are equal in length.

Brachylog (on TIO), 19 bytes
ḃḍ{↔|h1&b↔}ᵗlᵛ↖Lz≠ᵐ

Try it online!
lᵛ↖Lz is functionally equivalent to z₂ (if you don't use the variable L anywhere else), but it's also three bytes longer.

Python 2, 76 71 69 bytes
-5 bytes thanks to @Dennis ('' is present in '1', so replace in('','1') with in'1')
-2 bytes thanks to @xnor (use multiplication, (...)* in place of and)
f=lambda n:f(bin(n)[2:])if n<''else n in'1'or(n[0]!=n[-1])*f(n[1:-1])

Ideone
Recursive function, upon first call n is a number so it evaluates as less than the empty string, with if n<'', and the function is called again but with n cast to a binary string; the tail is either an empty string (even bit-length) or the middle bit, which returns true for empty or a '1'; on it's way down it tests the outer bits for inequality (equivalent to XOR) and recurses on the inner bits, n[1:-1].

I think n in'1' works.

Brilliant, I would not think '' was present in 'blah', but yes it is :)

The and can be arithmetic *.

Python 2, 63 bytes
s=bin(input())[2:]
while s[0]!=s[-1]:s=s[1:-1]or'1'
print'1'==s

Prints True or False. Takes the binary representation of s and repeatedly removed the first and last characters as long as they are unequal. Checks whether what remains is the empty string or a central 1. This is done by converting '' to '1' and checking if the result equals '1', which also avoid an index error on the empty string.

PowerShell v2+, 143 bytes
Two possible approaches, both the same byte count.
Method 1:
param($n)if($n-eq1){$n++}$o=1;0..(($b=($n=[convert]::ToString($n,2)).length-1)/2-!($b%2))|%{$o*=$n[$_]-ne$n[$b-$_]};$o*(+"$($n[$b/2])",1)[$b%2]

Takes input $n, if it's -equal to 1 (a special case for this algorithm), increment it. Set $output to be 1 (i.e., assume truthy), then loop from 0 to the midway point of the input number that has been [convert]ed to binary. Note the -!($b%2) to account for odd length binary numbers.
Each iteration, we compare the current digit $n[$_] with the digit the same length from the end $n[$b-$_], and multiply the Boolean result into $o (essentially performing an -and on all of them). Once the loop is done, we need to potentially account for the middle binary digit, that's the pseudo-ternary at the end (array indexed via $b%2). That 1 or 0 is left on the pipeline, and output is implicit.

Method 2:
param($n)for($n=[convert]::ToString($n,2);$n.Length-gt2){if($n[0]-ne$n[-1]){$n=$n[1..($n.Length-2)]}else{0;exit}}($n-join'+'|iex)-eq1-or$n-eq10

Takes input and does the same process to [convert] the number to binary. Then we're in a for loop so long as the .length of the binary string is -greaterthan 2. When we're in the loop, if the first $n[0] and last $n[-1] digits are -notequal, slice those two digits off of $n and re-store it into $n. Otherwise, output 0 and exit. Once we're out of the loop, we either have (an array of 1, 1,0, 0,1, 1,1, or 0,0), or the binary string for two 10, or 3 11. So, we need to test those two possibilities. For the first, we -join $n together with + and evaluate the result and test that it's 1 (this is true for arrays 1, 1,0, and 0,1, but is $false for arrays 0,0 and 1,1 or strings 10 or 11). The other half of the -or is testing whether $n is -equal to 10 (i.e., input of 2). That Boolean is left on the pipeline, and output is implicit.

CJam, 13 bytes
ri2b_W%.+:*3&

Try it online! or generate a list of folding numbers up to a given number.

ri2b   e# convert input to binary
_W%.+  e# flip and sum (if folding all bits are 1 except middle)
:*     e# product is 0 or power of 2 (2 if middle folds)
3&     e# keep only 1 or 2, everything else becomes 0 (false)

MATL, 13 bytes
BttP=<~5Ms2<*

Truthy is an array with all ones. Check truthy/falsy criteria here.
Try it online! Or verify the first 20 test cases.
Explanation
Using input 1644 as an example:
B     % Implicit input. Convert to binary
      %   STACK: [1 1 0 0 1 1 0 1 1 0 0]
t     % Duplicate
      %   STACK: [1 1 0 0 1 1 0 1 1 0 0], [1 1 0 0 1 1 0 1 1 0 0]
tP=   % Element-wise compare each entry with that of the reversed array
      %   STACK: [1 1 0 0 1 1 0 1 1 0 0], [0 0 0 0 0 1 0 0 0 0 0]
<~    % True (1) if matching entries are equal or greater
      %   STACK: [1 1 1 1 1 1 1 1 1 1 1]
5M    % Push array of equality comparisons again
      %   STACK: [1 1 1 1 1 1 1 1 1 1 1], [0 0 0 0 0 1 0 0 0 0 0]
s     % Sum of array
      %   STACK: [1 1 1 1 1 1 1 1 1 1 1], 1
2<    % True (1) if less than 2
      %   STACK: [1 1 1 1 1 1 1 1 1 1 1], 1
*     % Multiply
      %   STACK: [1 1 1 1 1 1 1 1 1 1 1]
      % Implicitly display

MATL, 16 bytes
tBn2/kW&\hBZ}P=~

Truthy is an array with all ones. Check truthy/falsy criteria here.
Try it online! Or Verify the first 20 test cases.
Explanation
Let's use input 1644 as an example.
t     % Imolicitly take input. Duplicate
      %   STACK: 1644, 1644
Bn    % Number of digits of binary expansion
      %   STACK: 1644, 11
2/k   % Divide by 2 and round down
      %   STACK: 1644, 5
W     % 2 raised to that
      %   STACK: 1644, 32
&\    % Divmod
      %   STACK: 12, 51
h     % Concatenate horizontally
      %   STACK: [12 51]
B     % Binary expansion. Each numnber gives a row, left-padded with zeros if needed
      %   STACK: [0 0 1 1 0 0; 1 1 0 0 1 1]
Z}    % Split into rows
      %   STACK: [0 0 1 1 0 0], [1 1 0 0 1 1]
P     % Reverse
      %   STACK: [0 0 1 1 0 0], [1 1 0 0 1 1]
=~    % True for entries that have different elements
      %   STACK: [1 1 1 1 1 1]
      % Implicitly display

PHP, 101 Bytes
for($r=1;$i<($l=strlen($b=decbin($argv[1])))>>1;)$r*=$b[$i]^1^$b[$l-++$i]^1;$r*=$l%2?$b[$i]:1;echo$r;

or with log
for($r=1,$s=log($n=$argv[1],2)^0;2*$i<$s;)$r*=($n>>$i)%2^($n>>$s-$i++)%2;$s%2?:$r*=($n>>$i)%2;echo$r;

108 Bytes with array
for($r=1,$a=str_split(decbin($argv[1]));$a;)$r*=array_pop($a)!=($a?array_shift($a):0);$r*=$a?$a[0]:1;echo$r;

True values <10000
1,2,6,10,12,22,28,38,42,52,56,78,90,108,120,142,150,170,178,204,212,232,240,286,310,346,370,412,436,472,496,542,558,598,614,666,682,722,738,796,812,852,868,920,936,976,992,1086,1134,1206,1254,1338,1386,1458,1506,1596,1644,1716,1764,1848,1896,1968,2016,2110,2142,2222,2254,2358,2390,2470,2502,2618,2650,2730,2762,2866,2898,2978,3010,3132,3164,3244,3276,3380,3412,3492,3524,3640,3672,3752,3784,3888,3920,4000,4032,4222,4318,4462,4558,4726,4822,4966,5062,5242,5338,5482,5578,5746,5842,5986,6082,6268,6364,6508,6604,6772,6868,7012,7108,7288,7384,7528,7624,7792,7888,8032,8128,8318,8382,8542,8606,8814,8878,9038,9102,9334,9398,9558,9622,9830,9894

C, 223 201 189 194 178 Bytes
i,j,m,l,r;f(n){for(m=j=1,i=n;i/=2;++j);for(l=r=i=0;i<j/2;i++)r|=n&m?1<<j/2-i-1:0,m*=2;i=(j&1&&n&m)?i+1:(j&1)?l=r:i;n>>=i;for(m=1;i<j;i++)l|=n&m,m*=2;return !(~(l^r)&(1<<j/2)-1);}

Brute force algorithm.  Let's see how far it can be golfed.
Better test setup  bugfixes...
 main()
 {
    int t, s, u, testSet[] =
    {
    1, 2, 6, 10, 12, 22, 28, 38, 42, 52, 56, 78, 90, 108, 120,
    142, 150, 170, 178, 204, 212, 232, 240, 286, 310, 346, 370,
    412, 436, 472, 496, 542, 558, 598, 614, 666, 682, 722, 738,
    796, 812, 852, 868, 920, 936, 976, 992, 1086, 1134, 1206,
    1254, 1338, 1386, 1458, 1506, 1596, 1644, 1716, 1764, 1848,
    1896, 1968, 2016, 2110, 2142, 2222, 2254, 2358, 2390, 2470,
    2502, 2618, 2650, 2730, 2762, 2866, 2898, 2978, 3010, 3132,
    3164, 3244, 3276, 3380, 3412, 3492, 3524, 3640, 3672, 3752,
    3784, 3888, 3920, 4000, 4032, 4222, 4318, 4462, 4558
    };

    for (u=s=0,t=1;t<=4558;t++)
    {
        if (f(t))
        {
          u++;
          if (testSet[s++]!=t)
              printf("BAD VALUE %d %d\n", testSet[s-1], t);
        }
    }

    printf("%d == %d Success\n", u,
           sizeof(testSet)/sizeof(testSet[0]));

}

Julia, 66 bytes
c(s)=s==""||s=="1"||(s[1]!=s[end]&&c(s[2:end-1]))
f(x)=c(bin(x))

My first golf! works the same way as the Python solution of the same length,
minor differences due to language (I did come up with it on my own, though...).
Explanation:
c(s) = s == "" || # Base case, we compared all the digits from
                  # both halves.
       s == "1" || # We compared everything but left a 1 in the middle
       (s[1] != s[end] &&  # First digit neq last digit (XNOR gives 0).
        c(s[2:end-1]))     # AND the XNOR condition is satisfied for the
                           # 2nd to 2nd to last digit substring.
f(x) = c(bin(x))  # Instead of a string f takes an integer now.

Retina, 71 70 60 bytes
.+
$*
+`^(1*)\1(1?)\b
$1 $.2
+`^ (.)(.*) (?!\1).$
$2
^( 1)?$

I probably still have a lot to learn about Retina (e.g. recursive regex?). Explanation: Step 1 converts from decimal to unary. Step 2 converts from unary to pseudo-binary. Step 3 removes digits from both ends as long as they mismatch. Step four matches an optional final central 1 if necessary. Edit: Saved 1 byte thanks to @mbomb007. Saved 10 bytes by improving my unary to binary conversion.

The first line can be .* or .+.

JavaScript, 71 bytes
(i,n=i.toString(2))=>/^(1*)2?\1$/.test(+n+ +n.split``.reverse().join``)

Defines an anonymous function.
This method may not be the shortest, but as far as I know, it is unique. It adds the number in binary to itself reversed, treating them as decimal, then checking if the result is valid using a regex.

Retina, 92 bytes
Byte count assumes ISO 8859-1 encoding.
.+
$*
+`(1+)\1
${1}0
01
1
^((.)*?)1??((?<-2>.)*$.*)
$1¶$3
O$^`.(?=.*¶)

T`01`10`^.*
^(.*)¶\1

Try it online
Convert to unary. Convert that to binary. Cut the number in half and remove a middle 1 if there is. Reverse the first half. Switch its ones and zeros. Match if both halves are equal.

Python 2, 61 59 bytes
Saving two bytes for converting shifts to multiplications
m=n=input()
i=0
while m:i*=2;i+=m&1;m/=2
print(n+i+1)&(n+i)

Returns 0 for a folding number and anything else for non-folding. Uses the bit-twiddling approach.

C, 65 63 bytes
Two bytes for converting shifts to multiplications
i,m;
f(n){
 m=n;i=0;
 while(m)i*=2,i+=m&1,m/=2;
 return(n+i+1)&(n+i);
}

Whitespace is already excluded from bytecount, returns 0 for a folding number and anything else for non-folding. Uses the bit-twiddling approach.

k, 77 bytes
{X:2 0N#X@&:|\X:0b\:x;c:#:'X;$[(~*X 1)|(=). c;~|/(=).(::;|:)@'(-&/ c)#'X;0b]}

by way of explanation, a translation to q
{X:2 0N#X where maxs X:0b vs x;
  c:count each X;
  $[(not first last X)or(=). c;
    not any(=).(::;reverse)@'(neg min c)#'X;0b]
  };