text:
Reverse Array Sum
Your program should take an array as input.
The array:

Will always be 1 dimensional
Will only contain integers
Can be empty

The program should reverse the array, and then add up the elements to the original for example:
Input: [1, 2, 3]
Original: [1, 2, 3]
Reversed: [3, 2, 1]
[1, 2, 3]
 +  +  +
[3, 2, 1]

[1+3, 2+2, 3+1]

Output: [4, 4, 4]

Test Cases:
#In             #Out
[8, 92],        [100, 100]
[1, 2, 3],      [4, 4, 4]
[5, 24, 85, 6], [11, 109, 109, 11]
[],             []
[999],          [1998]

This is code-golf, the shortest code (in bytes) wins!

J 3 bytes. Program is t. t=:+|.

@RichardDonovan Nice Answer! Can you submit as an answer instead of a comment please :)

Haskell, 20 bytes
5 bytes save by changing to a point free as suggested by nimi
zipWith(+)=<<reverse

Try it online!

go pointfree: zipWith(+)=<<reverse.

@nimi Wow I didn't think to do that but thats pretty smart.

Where do I put the array? I tried arguments, and input on TIO

@NoahCristino I fixed the TIO.  This is a point-free function so you just put the input after the function however Haskell requires a main to compile.

Ok, I'll try it out thanks!

Passed all tests!

@nimi I am trying to wrap my brain around the use of the bind here, can you offer an explanation how this magic works?!

@maple_shaft: we use =<< from the function monad which is defined as: (=<<) f g x = f (g x) x. Here, written in infix: (zipWith(+) =<< reverse) x -> zipWith(+) (reverse x) x.

Jelly, 2 bytes
+U

Try it online!
or
+Ṛ

Try it online!
(thanks @Mr. Xcoder for the second program)
explanation, though it's pretty self-explanatory
+U  Main link
+   Add, vectorizing,
 U                    the input, reversed

+Ṛ  Main link
+   Add, vectorizing,
 Ṛ                    the input, reversed, without vectorizing (same thing for depth-1 lists)

For empty array [], this outputs nothing. That is correct. Jelly's representation of an empty list is just simply nothing. Note that Jelly's representation of a list with a single element is just the element itself. Append ŒṘ to the code to see the Python internal representation of the output.

I found 2 issues. 1) When tested on [9] it outputs 18 instead of [18], and 2) when tested on [] it doesn't output anything.

@NoahCristino It's not a full program, and there's already an explanation for that in the answer.

So I guess this is fine, it's just how Jelly outputs it

@NoahCristino Yeah. I added a part to the end of my answer so you can put that atom at the end of the code to see how Python would print it.

+Ṛ works too.

@Mr.Xcoder Yes, thanks. I'll write that in as well.

JavaScript (ES6), 27 bytes
a=>[...a].map(e=>e+a.pop())

f=
a=>[...a].map(e=>e+a.pop())

console.log(f([8, 92])) // [100, 100]
console.log(f([1, 2, 3])) // [4, 4, 4]
console.log(f([5, 24, 85, 6])) // [11, 109, 109, 11]
console.log(f([])) // []
console.log(f([999])) //[1998]

Oh, man, I was almost there, but I didn't think to use the spread operator to do the clone.

Can you add the embedded try it for javascript?

05AB1E, 2 bytes
Â+

Try it online!

Passed all my tests!

R+ also works for 2 bytes.

Python 2, 32 bytes
lambda l:map(sum,zip(l,l[::-1]))

Alternative solution without zip (35 bytes):
lambda l:map(int.__add__,l,l[::-1])

Try it online!

Python 2, 40 bytes
lambda l:[i+j for i,j in zip(l,l[::-1])]

Try it online!
The other, shorter Python answer replaces a list comprehension with map. Wish I'd thought to do that faster. ;-;

Passes all my tests!

Japt, 7 bytes
mÈ+Ug~Y

Try it online! with the -Q flag to format the output array.
Explanation
Implicit: U = input array
mÈ

Map the input by the following function...
+Ug

The value, plus the value in the input array at index...
~Y

-(index+1), which gets elements from the end of the array.

Good job! I like the multiple input thing!

I really like the multiple-input Japt interpreter. Nice job!

That's really cool :-) I'd add that feature to the "official" interpreter, but with the current design it's sorta unextendable...

Ruby, 25 bytes
->a{[*a].map{|i|i+a.pop}}

Try it online!

Mathematica, 12 bytes
Reverse@#+#&

Try it online!

Python 2, 33 32 bytes
-1 byte thanks to @xnor
lambda l:[i+l.pop()for i in l*1]

Try it online!

Passed all my tests good job :)

What an unusual method. l*1 saves a byte.

I am having difficulties understanding the par l*1, any elaboration

@dhssa l*1 makes a copy of the list l. If we would not make a copy, pop() would delete elements from the list before they were accessed in the for loop.

Thanks for the explanation, I got it now. good trick to know for coding.

@dhssa If you want to copy a list in real python code, I would recommend you to use the functions provided by the copy module.

Brachylog, 6 bytes
↔;?z+ᵐ

Try it online!

Passes all cases, cool name.

J, 3 bytes
+|.

Reverse, sum.
Try it online!

C# (.NET Core), 61 60 bytes
-1 byte thanks to TheLethalCoder
a=>a.Reverse().Zip(a,(x,y)=>x+y).ToArray()

Try it online!
Byte count also includes:
using System.Linq;

For explanation - Zip function in LINQ takes two collections and executes given function for all corresponding elements, ie. both first elements together, both second elements etc.

Good answer. Thanks for the comment about the input.

Hello and welcome to PPCG! You don't need the trailing semi colon in the byte count. I believe you can return the collection straight from the Zip call to so no need for the ToArray(). Nice job!

@TheLethalCoder Thanks, and I added ToArray() since the challenge is about arrays, so I wanted the self-contained lambda to be array -> array.

Vyxal, 2 bytes
Ḃ+

Try it Online!
Ḃ+
Ḃ  # bifurcate, i.e. duplicate and reverse
 + # vectorized addition of two lists

Clojure, 20 17 bytes
3 bytes saved thanks to @MattPutnam
#(map +(rseq %)%)

Seems to be quite competitive with non-golfing languages.
See it online

Use rseq instead of reverse.

CJam, 7 bytes
{_W%.+}

Try it online!

It outputs "" for [], that's weird. Not your fault just the language.

@NoahCristino That's CJam's representation of [].

Yup, it's hard to have a standard output for my challenge since many languages display arrays differently especially [], and [4], so it's fine.

R, 17 16 bytes
-1 byte thanks to djhurio
rev(l<-scan())+l

Reads from stdin; returns the vector; numeric(0) is the zero-length numeric vector for the empty list.
Try it online!

For an empty "array" it returns numeric(0)

@NoahCristino an empty vector is represented as numeric(0) in R.

That's fine. @LeakyNun

rev(l<-scan())+l, 16 bytes?

For the record, an R+pryr functional alternative is just one byte longer: pryr::f(rev(x)+x)

APL (Dyalog), 3 bytes
⌽+⊢

Try it online!
Explanation
⌽          The argument reversed
+           Plus
⊢          The argument

ninja'd. I need to move to an APL keyboard... xD

@Uriel I am always on my APL keyboard :D

Love the simplicity. It outputs ⌽+⊢ with no input

@NoahCristino An empty input is specified with ⍬, the empty vector. With no argument, it prints the train by itself

Pyth, 3 bytes
+V_

Try it here.

Yay passes all my tests!

Equivalent: sV_

@Mr.Xcoder nevermind

PowerShell, 40 32 bytes
($n=$args)|%{$n[-++$i]+$n[$i-1]}

Try it online!
Takes input as individual command-line arguments, which is allowed as one of the native list format for PowerShell. Then loops through each element (i.e., a shorter way of looping through the indices), adding the element counting from the back (-1 indexed) to the current element (0 indexed, hence the decrement -1). Those are left on the pipeline and output is implicit.
Saved 8 bytes thanks to @briantist

it doesn't output an array.

@NoahCristino PowerShell input/output is, in general, weird. It is outputting as an array, it's just there's nothing capturing said array, and so when the implicit Write-Output happens, it puts things on stdout one item per line. For example, you can see here that, when captured, the object is indeed an array type.

Good enough then :) atleast it tried

I'm on mobile and can't test so easily, but isn't it 1 byte shorter to remove the param and then replace 1..$n with 1..($n=$args)?

@briantist Not quite, but you did give me a different way of thinking about it, saving a bunch of bytes. Thanks!

PowerShell, 26 bytes
($a=$args)|%{+$a[--$i]+$_}

Try it online!
Takes input as command-line arguments.

Can you add a TIO? and a link under the name like this one: https://codegolf.stackexchange.com/a/135427/61877

@NoahCristino: Like this? Haven't used that thing so far, so no idea what I may have done wrong. By the way, if you expect people to use a certain service in their answers, then please state so in the task description.

That's fine. It's not required it just makes the answers more high quality, and easier to test out for future viewers.

C, 49 bytes
f(a,n,b)int*a,*b;{for(b=a+n;a<b--;a++)*a=*b+=*a;}

Shouldn't a,n,b be a,b,n or something?

@EriktheOutgolfer No, b isn't a parameter for the function, just an extra definition stuffed in there for golfing reasons. a must be a pointer to integers, and n must be how many integers there are in the array.

Could you please add a TIO link?

Java 8, 61 57 56 53 bytes
a->{for(int l=0,r=a.length;l<r;a[l]=a[--r]+=a[l++]);}

-1 byte and bug-fixed thanks to @Nevay.
-3 bytes thanks to @OliverGrégoire.
(It was a port of (and golfed by 4 8 bytes) of @jkelm's C# answer, but now it's a different shorter solution thanks to @OliverGrégoire.)
Explanation:
Try it here.
The method modifies the input-array to save bytes, so no need for a return-type.
a->{                    // Method with integer-array parameter and no return-type
  for(int l=0,          //  Left-integer (starting at 0)
          r=a.length;   //  Right-integer (starting at the length of the input-array)
      l<r;              //  Loop as long as left is smaller than right
    a[l]=               //   Change the number at the current left index to:
         a[--r]+=a[l++] //    The number at the right index + itself
                        //    (The += adds the number at the left index also to the right index)
                        //    (And the --/++ increases/decreases the indexes by 1,
                        //     until we've reached the middle of the array)
  );                    //  End of loop
}                       // End of method

You can save 1 byte by using a->{for(int i=0,l=a.length;i<l/2;a[i]=a[l+~i]+=a[i++]);}.

Besides that the code fails for arrays with an odd length 1,2,3 (returns 4,2,4 instead of 4,4,4), the loop has to run as long as 2*i<l, not i<l/2.

@Nevay Thanks. I knew it should be possible to golf l-i-1, just couldn't come up with it..

53 bytes: a->{for(int l=0,r=a.length;l<r;a[l]=a[--r]+=a[l++]);}.

Sorry for the not-identical variable names (short for left and right): I was implementing it by myself before seeing that you had posted an answer.

@OlivierGrégoire Thanks. And your l and r makes sense for your implementation, so I've used those as well (and added an explanation).

K4 / K (oK), 5 bytes
Solution:
x+|x:

Try it online!
Example:
x+|x:,()
,()
x+|x:8 92
100 100
x+|x:,999
,1998

Explanation:
Not quite as elegant as the J solution, but same kinda thing:
x+|x: / the solution
   x: / store input as x
  |   / reverse it
 +    / add to
x     / x

Nice! I like the line by line explanation

Factor, 18 bytes
[ dup reverse v+ ]

Try it online!
Explanation
         ! { 1 2 3 }
dup      ! { 1 2 3 } { 1 2 3 }
reverse  ! { 1 2 3 } { 3 2 1 }
v+       ! { 4 4 4 }

tinylisp, 44 39 bytes
(load library
(q((p)(map* a p(reverse p

-5 bytes thanks to @DLosc
Try it online!
Explanation
An anonymous function that maps the a function (addition) over pairwise elements in the input and the reverse of the input, forming a new list.

map* is your friend here: Try it online!

K (ngn/k), 6 bytes
{x+|x}

Try it online!

PHP, 59 bytes
for(;a&$c=$argv[++$i];)$a[]=$c+$argv[$argc-$i];print_r($a);

takes input from command line arguments; empty output for empty input
Yields a warning in PHP>7.0. This version does not (60 bytes):
for(;++$i<$argc;)$a[]=$argv[$i]+$argv[$argc-$i];print_r($a);

Nice answer! :)

Swift 3, 30 bytes
{zip($0,$0.reversed()).map(+)}

Can you add a try link?

@NoahCristino Done

Unfortunately, this is a snippet. Since Swift has no useful input method, you must take the input as a function. Hardcoding the input into a variable is disallowed by meta consensus. See Default for Code Golf: Input/Output methods for more details. That's the reason I incorporated my answer into a function, too.

@Mr.Xcoder {zip($0,$0.reversed()).map(+)} 30 bytes

@Alexander You should edit your answer.

@Mr.Xcoder That's not a particularly sensible distinction to make. It just forces people into using languages specifically designed to circumvent this, by implicitly taking input from STDIN, implicitly printing last return value, and crap like that

@Alexander Please trust me when I say hardcoding is not allowed. I think this is a great answer once it fits the default I/O rules

@Mr.Xcoder It's not that I don't trust you, I just take issue with the rules. If people are allowed to design languages with implicit input capabilities, why is it disallowed to mimic the behavior with a repl with predefined variables?

Let us continue this discussion in chat.

JavaScript (ES6), 34 33 bytes
Saved a byte thanks to @ETHproductions.
a=>a.map((e,i)=>e+a[a.length+~i])

let f=

a=>a.map((e,i)=>e+a[a.length+~i])

console.log(f([8,92]));
console.log(f([1,2,3]));
console.log(f([5, 24, 85, 6]));
console.log(f([]));
console.log(f([999]));

I love how you put in the test cases, +2

I think you can save a byte by changing -i-1 to +~i.

@ETHproductions, yes, thanks!

Ohm, 3 bytes
DR+

Try it online!

It outputs floats, but I never said it couldn't, so that's fine, and for [] it doesn't output anything but that's just the language.

Actually, 4 bytes
;R♀+

Try it online!

Perfect, great job.

Erik, solving my problem in like 7 languages xD

@NoahCristino Yeah I'm trying to keep it under 15...;)

I'm going to have to start adding a -1 for every submission xD

anyfix, 3 bytes
"U+

The version on TryItOnline! is an outdated version of anyfix, which contains a few fatal errors such as not being able to add lists because of typos in the source code. Use the code on GitHub instead.
"U+  Program
"    Duplicate top of stack
 U   Reverse top of stack if it is a list (which it should be...)
  +  Add, vectorizing for lists

Röda, 22 bytes
{reverse(_)<>_1|[_+_]}

Try it online!
This is an anonymous function that takes in an array and returns a stream of values, which the TIO link outputs separated over newlines.
Explanation
reverse(_)          The array reversed
<>                  interleaved with
_1                  the array itself
                    Push each element to the stream
[_+_]               Pull two values and push their sum

Passes my tests! Great answer.

Neim, 2 bytes
This is a function that takes input on the top of the stack and outputs on the top of the stack.

Try it online!

Is it allowed to modify the input stack via actual Neim code instead of normal input methods?

@LiefdeWen Yes, that's allowed in the defaults for I/O meta post.

MATL, 3 bytes
tP+

Try it online!
Extremely straightforward. t duplicates the input. P flips (reverses) it, and + adds the two arrays element wise.

J-uby, 21 bytes
:zip%:reverse|:*&:sum

Try it online!

HP 48 User REPL, 19 bytes
« DUP REVLIST +
»

Explanation
« and » mark the object as a program.
DUP - Duplicates the list
REVLIST - Reverses the list
+ - Sums them

Pyth, 5 bytes
sMC_B

Try it online!

Passed all my tests, congrats!

@NoahCristino Thanks, unfortunately got outgolfed

x86 Machine Code (32-bit protected mode), 19 bytes
8D 34 B7 39 F7 73 0C 83 EE 04 8B 07 03 06 89 06 AB EB F0 C3

The above bytes of code define a function that takes two parameters (a pointer to the array in the EDI register, and the length of the array in the ESI register), modifies the pointed-to array to contain the "reverse array sum", and then returns. It does not return a value to the caller.
(This is a custom calling convention used to receive the arguments. It is actually the standard calling convention used on Gnu/Unix systems for x86-64 binaries, but in x86-32, arguments are typically passed on the stack. That takes more bytes to encode, and is less efficient, so we want to ensure that the arguments are passed to us in registers. As far as I understand the rules, this is completely legal. We don't need to conform to a particular standardized calling convention. Certainly, when writing assembly, the programmer is free to define her own calling conventions, unless she needs to interoperate with C code.)
Note that this function also assumes the direction flag is cleared (DF == 0) upon entry to the function. This is a sensible assumption, as it is guaranteed by most platform ABIs, including the Linux x86 32-bit ABI. If you need the code to work under circumstances where the state of DF cannot be assumed, then you need to add a 1-byte CLD instruction to the top of the function.
Ungolfed assembly mnemonics:
               ; void ReverseArraySum(int *pArray, int length);
8D 34 B7         lea    esi, [edi+esi*4]        ; compute back pointer
               Loop:
39 F7            cmp    edi, esi
73 0C            jae    End                     ; finished when EDI >= ESI
83 EE 04         sub    esi, 4
8B 07            mov    eax, DWORD PTR [edi]
03 06            add    eax, DWORD PTR [esi]
89 06            mov    DWORD PTR [esi], eax
AB               stosd  ; equivalent to 'mov DWORD PTR es:[edi], eax' + 'add edi, 4'
EB F0            jmp    Loop
               End:
C3               ret

Conceptually, the code is pretty straightforward. We just iterate through the array using two pointers. The first pointer is passed to us as an argument, in the register EDI, and it is a pointer to the beginning of the array. The second pointer is computed (initial LEA instruction) by adding the address of the beginning of the array to the length of the array, scaled by the size of an element in the array (4 bytes for an int on x86-32). Thus, ESI is a pointer to the end of the array.
At the top of the Loop, we check the pointers to see if we should keep looping or if we are finished. Normally, we'd want to save bytes by putting this test at the end of the loop (and eliminating the JMP you see at the end now), but we can't do that because the challenge requires us to handle an empty input array.
Inside the body of the loop, we:

Eagerly subtract 4 bytes (the size of a single element in the array) from the back pointer, ESI.
Retrieve and store the value of the element pointed to by the front pointer (EDI) in a temporary register (EAX).
Increment EAX by the value of the element pointed to by the back pointer (ESI).
Store the sum (EAX) in the element pointed to by the back pointer (ESI).
Store the same sum (EAX) in the element pointed to by the front pointer (EDI), while simultaneously incrementing that pointer (EDI) by 4 bytes (the size of a single element in the array). The handy x86 string instruction STOSD is what allows us to do both of those things in only a single byte of code.
(With the caveat given at the outset, that the direction flag is cleared, and also the assumption that we are running in flat mode, where the "extra" segment (ES) is identical to the data segment (DS).)

Finally, we're done and we return to the caller, without returning any value.
__
You can see it run on TIO, but note that the TIO link uses a C wrapper to exercise the machine code, and GCC won't necessarily respect our custom calling convention, so we have to add extra code at the top of the function to retrieve the parameters from the stack and put them into the appropriate registers.

Interesting language choice!

Common Lisp, SBCL, 33 bytes
Pretty simple solution (very similiar to Clojure one):
(lambda(x)(mapcar'+(reverse x)x))

Example of use:
((lambda(x)(mapcar'+(reverse x)x))'(1 2 3)))

Try it online!(with print function, to show output from function)

MY, 49 48 5 bytes
ωω⌽+←

Try it online!
How?
First, you bang your head against the wall after remembering that addition on strings isn't commutative. Then, you bang your head yet again after realizing that you could've used ω to save over 40 bytes! Finally, you arrive at this:
ω    - First command line argument
ω⌽   - First command line argument, reversed
+    - Add (vectorizes)
←    - Output without a newline

Positron, 59 bytes
->{a=[]i=0;while(i<len@$1)do{a+=[$1@i+($1@(-(i+1)))]i++};a}

Try it online!
This has many golfing opportunities that have been ruined by Positron's brokenness :P

Never heard of Positron before, but it passes all the tests :)

@NoahCristino It's a really hacky and horribly malfunctioning language that I made :)

It would be cool to golf in you're own language lol

@NoahCristino It is quite cool, but it would be cooler if it actually worked properly :))) :P

Ruby 2.4, 31 bytes
Hooray, TIO supports Ruby 2.4 now!
->a{a.zip(a.reverse).map &:sum}

Try it online!

Passes all cases, good job!

Perl 6, 15 bytes
{$_ Z+.reverse}

Try it online!

Works! Good job.

Swift, 76 68 58 bytes (returns an Array)
-8 bytes thanks to @Alexander.
func f(l:[Int]){print(zip(l,l.reversed()).map(+))}

Try it online!

Swift, 76 66 bytes
func f(l:[Int]){for i in 0..<l.count{print(l.reversed()[i]+l[i])}}

Try it online!
Prints the sums separated by a newline. For [1,2,3], the output is:
4
4
4

Works perfect good job

You can just use map(+)

@Alexander Welcome to PPCG! Thanks for the tip!

C# (.NET Core),65 57 bytes
-8 bytes thanks to Kevin Cruijssen
n=>{for(int i=0,o=n.Length;i<o/2;)n[i]=n[o-1-i]+=n[i++];}

Try it online!

How do I input into this?

It throws 18 errors for me.

@Mr.Xcoder Since it's C, that's probably just 1 error.

@HyperNeutrino: It's C#.

@Joey close enough :P

@Mr.Xcoder Fixed the TiO link, there was an opening brace missing.

@Ventero I didn't downvote though

@NoahCristino it's a lambda. Assign it to a variable like var a = n=>... and then try a(<your_array_here>)

You can golf 4 bytes by changing =n[i]=n[i]+ to =n[i]+=. And judging by the previous comments a bracket was missing causing some errors/confusion, so I'll +1 to neutralize the downvote (not by me!) now that that's fixed.

Just created a port of your answer in Java 8, and I noticed you can golf 4 more bytes by swapping the n[o-1-i] and n[i], so you'll use the shorter n[i] twice instead of n[o-1-i]. So it will become this: n=>{for(int i=0,o=n.Length;i<o/2;)n[i]=n[o-1-i]+=n[i++];} (57 bytes)

@KevinCruijssen Thanks for the golfing. I didn't even think of the += there for some reason.

@jkelm No problem. Also, Nevay golfed one more by in my Java 8 answer, and also bug-fixed incorrect results for odd-length lists (i.e. 1,2,3 currently returns 4,1,4 instead of 4,4,4). o-1-i can be o+~i for -1 byte; and i<o/2 should be i*2<o to fix the bug.

Python 2 + numpy, 31 bytes
I think this is kosher based on the rules, but let me know if not.
Anonymous function takes a numpy array as input:
import numpy
lambda l:l+l[::-1]

Try it online!

It works, but why does it output so weird? Some are like: [4 4 4] which is already weird for python, and then one is like [ 11 109 109  11]???

Probably because its a numpy array rather than a list

It's allowed but please specify that you are using numpy in the header next time. I've done it for you this time.

@totallyhuman, I haven't seen that on other posts, but I'll keep it in mind from here on out, thanks for the edit!

Looks weird, but it works.

@NoahCristino, that's what this site is all about, right?

The general rule of thumb is that if you use an external library that doesn't come packaged with the language, it should be added to the header. So you don't need to mention urllib2 because it comes included with Python, but requests will need to be mentioned.

Racket, 30 bytes
(lambda(l)(map +(reverse l)l))

Try it online!
This is simply an anonymous function that maps corresponding elements from l and l reversed to the + function, returning the results in a list.

Works fine, good job.

Retina, 31 bytes
\d+
$*1;$&$*
O$^`;1+

;

1+
$.&

Try it online! Explanation:
\d+
$*1;$&$*

Convert to unary and duplicate each element.
O$^`;1+

Reverse the order of the duplicate elements.
;

Add the elements to their reversed duplicates.
1+
$.&

Convert the elements back to decimal.

Good answer, but does your code need the newlines? or could it be squished into 1 line?

@NoahCristino No, in Retina the newlines normally delimit statements. (The exception is the command-line option to place each statement in a separate file.)

C++14, 57 bytes
As generic unnamed lambda requiring a container and returns via modifying its input:
[](auto&L){auto R=L;auto r=R.end();for(auto&x:L)x+=*--r;}

Try it online!
Ungolfed:
[](auto&L){
 auto R=L;      //copy of the list
 auto r=R.end();//iterator of last+1
 for(auto&x:L)  //foreach
  x+=*--r;      //move iterator to front and sum
}

Nice job, can you include a try it link?

@NoahCristino sure, didnt know TIO can generate CodeGolf posts. Now i do :)

8th, 22 bytes
Code
clone a:rev ' n:+ a:op

SED (Stack Effect Diagram) is: a -- a
Ungolfed code with comments
: f \ a -- a
  clone      \ clone array on TOS
  a:rev      \ reverse array
  ' n:+ a:op \ Add the corresponding elements of each array producing a new array
;

Usage
ok> [8,92] clone a:rev ' n:+ a:op .
[100,100]

Test cases
ok> [8,92] f .
[100,100]
ok> [1,2,3] f .
[4,4,4]
ok> [5,24,85,6] f .
[11,109,109,11]
ok> [] f .
[]
ok> [999] f .
[1998]

Never heard of this language before great job!

Casio-Basic, 25 bytes
l+seq(l[x],x,dim(l),1,-1

Addition threads over lists by default - but there's no built-in for reversing a list! seq is used to generate the reversed list by indexing backwards through it.
24 bytes for the function, +1 byte to add l in the parameters box.

Cool! I don't know much about this language, but is it possible to add a try it link?

There isn't really a way to try it online - but, if you're willing, you can download the 90 day free trial of the calculator emulator software from http://edu.casio.com/softwarelicense/index.php. If it redirects you to the home page, just click on software/app at the top right and get the appropriate ClassPad II Manager for your OS. :)

Cool! I'll try it out.

ARBLE, 28 bytes
map(a,a+index(c,len(c)-b+1))

Try it online!

Nice job, never heard of ARBLE!

Stax, 5 bytes
òôΩo1

Run and debug it
I like that sequence of o-style chars (òôΩo).
Explanation (unpacked):
cr\m|+ Full program, implicit input  e.g.: [1, 2, 3]
cr     Copy and reverse                    [1, 2, 3] [3, 2, 1]
  \    Zip                                 [[1, 3], [2, 2], [3, 1]]
   m|+ Map sum of array                    [4, 4, 4]
       Implicit output

Nice solution, never heard of Stax before!

Add++, 8 bytes
L,dbRz£+

Try it online!
Finally something sane with Add++
Explained
L,dbRz£+
L,        ; create a lambda that:
  dbR     ; pushes the input list and its reverse
     z    ; zips those together
      £+  ; and reduces each pair by addition

Pip -p, 4 bytes
g+Rg

Attempt This Online!
Explanation
Just what it says on the tin.
   g  List of command-line arguments
  R   Reversed
g+    Add to the original list

(Addition operates element-wise on lists in Pip.)

Risky, 7 bytes
0__2-?_+_?+_0

Try it online!
Appends -? (first input reversed) to __ (all inputs, which is in this case a trick to wrap the input array), and then transposes. Maps with sum, which is the most complicated usage of Risky's quicks that I'm even going to attempt.

Desmos, 22 bytes
f(l)=l+l[l.length...1]

Pretty self-explanatory
Try It On Desmos!
Try It On Desmos! - Prettified

J-uby, 14 bytes
:zip%:~|:*&+:+

Attempt This Online!
:zip % :~ |           # Zip array with its reverse, then
            :* & +:+  # Map with sum

Thunno 2, 2 bytes
r+

Attempt This Online!
r is reverse and + is add.

Tcl, 49 bytes
lmap l $L r [lreverse $L] {lappend N [incr l $r]}

Try it online!

Pari/GP, 14 bytes
a->a+Vecrev(a)

Try it online!

Scala, 49 bytes
(a:Seq[Int])=>a.zip(a.reverse)map{case(a,b)=>a+b}

Lambda. Paste in the REPL, it gets assigned to a default variable, like res0 or whatever. Note the variable name from the output produced after pasting that line into the REPL and pressing Enter, let's say it's res4. To call the lambda, just use res4(Seq(1, 2, 3)) or res4(Seq(89, 88, 1, 2, 3, 1000, 2000)) for the test cases.
Implementation notes:
zip creates a Tuple2 from 2 Seqs, which need to be unpacked in the pattern match (the case expression after the map) before the elements can be added. Indexed access is convoluted for golfing in Scala...
Here's another version, using convoluted indexing tricks for 57 bytes:
(a:Seq[Int])=>{val l=a.size-1;0.to(l)map(i=>a(i)+a(l-i))}

This just produces a new Seq from adding the "complementary" elements of the Seqs (symmetrically about the mid of the Seq. Very imperative.
I don't like it either, but the type ascriptions are necessary to get the REPL to accept it, otherwise it just botches out Missing Parameter Type.
The idea in the 2nd version can be used in Java 8 as well, just swapping in IntStream.rangeClosed(0,l) instead of Scala's implicit to on Ints, unlike the former, which would be considerably more convoluted in Java.
Note that @jkelm's answer for C# can be trivially translated to Java.

Stacked, 7 bytes
[:rev+]

Try it online!
Just adding to the reversed.

Easy to understand! Output is ok I guess.

R: 19 bytes
function(v)rev(v)+v
Try It Out:
http://www.r-fiddle.org/#/fiddle?id=vJhwqK77

Hello and welcome to the site.  I don't know R very well This looks like what is called a snippet which we do not allow for answers here.  Your answer may be either a function (anonymous or named) or a full program.

Clojure, 21 bytes
#(map + %(reverse %))

Try it online!
Having trouble golfing this any further. Any clever ideas?

There's already a similar answer a little ahead of you. Flip the last two args to eliminate a space, and use rseq instead of reverse.

Husk, 4 bytes
Sz+↔

Try it online! (Note if you want to test with empty list, you need to supply: []:LN as argument)
Ungolfed/Explanation
      -- implicit input list        - [1,2,3]
S     -- "duplicate input and"      - [1,2,3] [1,2,3]
   ↔  -- reverse one copy           - [1,2,3] [3,2,1]
 z+   -- zip with original using +  - [1+3,2+2,3+1]

Perl 5, 24 + 1 (-a) = 25 bytes
print$_+$F[--$i],$"for@F

Try it online!

Uiua, 3 bytes
+⇌.

Try it!
+⇌.
  .  # duplicate
 ⇌   # reverse
+    # add

J, 5 bytes
(+|.)

    (+|.) 1 2 3    ===> 4 4 4
    (+|.) 89 98 1 2 3 1000 2000  =====> 2089 1098 4 4 4 1098 2089

    NB. Does not work without the parentheses as per previous answer by @Jonah

While there's no shame in arriving independently at an answer that is identical to someone else's, this isn't the case here. +|. is valid on its own, so this is just a less golfed version of Jonah's answer.

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


text:
Calculating BPM with inputs
Program the shortest code that will calculate the average BPM (Beats per Minute) using 8 data points of time passed. This is my first post, and I haven't seen a question similar to this. Since I am a fan of rhythm games, it would be nice to have a small handy tool to calculate BPM using your own keyboard and your own sense of rhythm (if you have one...)
Challenge

All inputs must be singular. (i.e. Only pressing "enter" as "input")
Your program must take at least 9 inputs. (To create 8 data points of time passed.)
Your program should output the BPM of the keypresses rounded at 2 decimal points. (i.e. 178.35)
Timing starts at first input. Not start of program

This is code-golf, so the shortest answer wins.
Example Input and Output
Provide at least one example input and output. Make sure they match your own description of what the input should look like.
Input:
> [Enter-Key]
# User waits 1 second
...  7 more inputs
> [Enter-Key]

Output:
> 60

Current winner is KarlKastor at 22 Bytes using Pyth
Even though the winner was using Pyth, the Matlab answer was a notable answer.

Ha! Interesting, welcome to PPCG; for future reference we also have a sandbox where you can get feedback on your challenges before posting them. This is pretty well done though.

How do we compute the BPM? Do we start timing on the first keypress or when the code starts running? Do we divide by 7 or 8 before extrapolating?

Hmm.. So timing should start on the first keypress. As for division, I will change it to do 9 inputs (so you divide by 8)

Cool question! Good luck

Pyth, 22 bytes
 wJ.d0 mw8.Rc480-.d0J2

(yes there's a leading space)
Input is 'enter' presses.
If additional output is allowed I can remove the spaces and get a score of 20 bytes.

explanation
 wJ.d0 mw8.Rc480-.d0J2
 w                      # take the first input
                        # (space) throw the result away
  J.d0                  # store the current system time in J
       mw8              # take 8 inputs and throw the result away
                 -.d0J  # difference of current time and J
             c480       # divide 480 by this
           .R         2 # round to 2 decimal places

MATLAB/Octave, 58 56 55  bytes
Thanks @LuisMendo for -1 byte!
input('');tic;for k=1:7;input('');end;fix(48e3/toc)/100

You have to press enter 9 times. (Also works in Octave.)
Here you see it in action, left MATLAB, right Octave:

D'oh! but is round(.,2) does not work, or does it in the newer versions?

Oh, it only works in Matlab

JavaScript (ES6), 77 74 bytes
(i=8,n=Date.now,t)=>onclick=_=>(t=t||n(),i--||alert((48e6/(n()-t)|0)/100))

Creates an onclick event on the global window object. Send beats by clicking anywhere in the window.
Test Snippet

let f=
(i=8,n=Date.now,t)=>onclick=_=>(t=t||n(),i--||alert((48e6/(n()-t)|0)/100))

f()
document.write("Running... click anywhere here")
*{user-select:none}

632.41! quite a good calc :) +1

Python 3, 93 92 81 bytes
Saved 11 bytes thanks to Felipe.
import time
a,*l,b=[input()or time.time()for i in' '*9]
print(round(480/(b-a),2))

81 bytes

i tried print('%.2f'%(480/(b-a))) and print(f'{480/(b-a):.2f}') (python3.6+), but both have the same bytecount

Bash + common Linux utilities, 58
script -tt -c'sed -n 9q'
sed '1c2k0
s/ 2/+/;$a480r/p' t|dc

Javascript, 100, 84 thanks to Powelles, 82 bytes thanks to Justin Mariner
z=>{(a=alert)();i=0;s=(n=Date.now)();while(i++<8)a();a((48e4/(n()-s)).toFixed(2))}

(z=>{(a=alert)();i=0;s=(n=Date.now)();while(i++<8)a();a((48e4/(n()-s)).toFixed(2))})();

You should be able to use Date.now() instead of new Date().getTime() and 48e4 instead of 480000.

Also you can alert the result back instead of returning it and assign alert to a variable like (a=alert)() for your first usage and then later use a().

Ah thanks a lot, I'd never thought of 48e4, and instanciate AND call alert together : (a=alert)().

You can also switch s to use Date.now(), and drop the .getTime() later. And then you can alias Date.now to a shorter name. And the initial z= isn't needed since you aren't calling the function recursively. Down to 69 bytes here

Oh, and your solution doesn't round to 2 decimal places like the challenge asks for.

Java 1.5+, 345 339 361 337 bytes
-34 bytes thanks to Michael for pointing out I forgot to fix my imports
import java.awt.event.*;class B{public static void main(String[]a){new java.awt.Frame(){{addKeyListener(new KeyAdapter(){long x=System.currentTimeMillis();int b=0;public void keyPressed(KeyEvent e){if(e.getKeyChar()==' '&&b++==9){System.out.println(Math.round(6000000.0*b/(System.currentTimeMillis()-x))/100.0);}}});setVisible(1>0);}};}}

Listens to the user as they press the space bar. Then, when the user has pressed it 9 times, prints back to the user the current BPM:

Image has debug messages not present in golfed code.

Ungolfed:
import java.awt.event.*;

class B {
    public static void main(String[] a) {
        new java.awt.Frame() {
            {
                addKeyListener(new KeyAdapter() {
                    long x = System.currentTimeMillis();
                    int b = 0;

                    public void keyPressed(KeyEvent e) {
                        if (e.getKeyChar() == ' ' && b++ == 9) {
                            System.out
                                    .println(Math.round(6000000.0 * b
                                            / (System.currentTimeMillis() - x)) / 100.0);
                        }
                    }
                });
                setVisible(1 > 0);
            }
        };
    }
}

Kinda fun to try and get a highscore...
KEY PRESS0 AT 250ms.
KEY PRESS1 AT 343ms.
KEY PRESS2 AT 468ms.
KEY PRESS3 AT 563ms.
KEY PRESS4 AT 672ms.
KEY PRESS5 AT 781ms.
KEY PRESS6 AT 880ms.
KEY PRESS7 AT 989ms.
485

I made a minor change and that I wanted 9 inputs so you could have 8 data points for input instead of 7. (should just be a small change.)

Missed a space: String[]a) {new java

Another thing is, I put a requirement that says "It should output the BPM of the keypresses rounded at 2 decimal points." Does this round to 2 decimal places?

@xNinjaKittyx does now.

Are you sure you need awt? Wouldn't that be shorter in console?

record is 2027.03 BPM xD slightly modified the code for some better benchmarking

You can change java.awt.Frame to Frame. You've got 2 classes prefixed with java.awt.event. so it's less verbose to just import java.awt.event.*; and remove those prefixes. You can get rid of the braces around the if. You can declare b as a long on the same line as x. No idea what the six million is for but you can represent it in scientific notation as 6e6. 100.0 can drop the last zero.

@XtremeBaumer Something tells me you weren't hitting the spacebar at 33Hz (which would sound the note C0).  Does that rely on the repeat-rate of the key?  Apparently on Linux the behavior of Java's KeyListener does not handle a key held down the same way as on Windows (on Linux it is treated like multiple keypresses even without a key-up event) - see https://stackoverflow.com/questions/1736828/how-to-stop-repeated-keypressed-keyreleased-events-in-swing

@DarrenRinger its true that i held down the key. the repeat-rate is still default setting, yet it was not always consistent. most times i had 2020.2 BPM and only once the slightly higher value

@flawr meh, I suppose you could just put a scanner in a loop; I thought this was more interesting. while(b!=9){new Scanner().nextLine();b++;}System.out.println([MATH SHIT]); would work fine.

@MagicOctopusUrn Well this is [tag:code-golf] :)

C# (.NET Core), 193 206 189 186 155 143 137 bytes
-47 bytes thanks to TheLethalCoder
-4 bytes thanks to Nazar554
-16 bytes thanks to Luc
-2 bytes thanks to Kamil Drakari
_=>{var x=new long[9];for(int i=0;i<9;){Console.ReadKey();x[i++]=DateTime.Now.Ticks;}return Math.Round(48e8/(x[8]-x[0]),2);}

Also added to byte count:
using System;

Whole program:
namespace System
{
    class A
    {
        static void Main()
        {
            Func<int, double> f = _ =>
            {
                var x = new long[9];
                for (int i = 0; i < 9; )
                {
                    Console.ReadKey();
                    x[i++] = DateTime.Now.Ticks;
                }
                return Math.Round(48e8 / (x[8] - x[0]), 2);
            };
            Console.WriteLine(f(0));
        }
    }
}

It would be shorter to have two variables have one outside the loop after the first key press for start time and then overwrite another in the loop. I don't think you need to format the output value so just +"" or even returning the double would be fine. namespace System.Diagnostics{} is probably shorter but you only use Diagnostics on the w so fully qualifying that is probably shorter too. Note that you should include using System; in your byte count for the Console call.

Using a for loop and initialising i in it is probably shorter than the while loop. And I think that might be it!

replace 540000.0 with 5.4e5

@TheLethalCoder challenge rule is that the result has to be rounded to 2 decimal points, that's the reason I used string with formatting. Thank you for the tips.

@Nazar554 thank you for the tip

@GrzegorzPuławski Ah thought it said at least, can ignore that then. But namespace System.Diagnostics{} is shorter than the two usings.

@TheLethalCoder yes, I'm in progress of updating the code.

You can drop the trailing semi colon, change () to _ (empty/unused inputs are allowed). Would using two longs be shorter than the array? Would using DateTimes be shorter than the Stopwatch?

@TheLethalCoder array is shorter because of the cute w.ElapsedMilliseconds that would need to be used twice in code. And DateTime comparison is quite lengthy, because you can't compare it directly, but by using TimeSpan class (from what I can tell looking at documentation). Added the tip about semicolon and ()

Well you'd do something like (end-start).Milliseconds and set end and start to DateTime.Now.

@TheLethalCoder ah yes, it dropped bytes by a lot (to 155). Thank you. I also tried to somehow get rid of the array, but the lowest i managed to go with DateTime was 174, so more than with array.

Yeah probably because of the repeat calls with DateTime in them. Glad I could help!

I think you've got an error in your calculation. If you replace ReadKey with Thread.Sleep(100), you should get a bit less than 600 BPM, but your code gives more than that (around 670 BPM). The formula should be "60sec * 1000ms / (deltaMs / 8points)" which translates to  "48e8 / deltaMs". Also, you can return$"{48e8/(d[8]-d[0]).Ticks:n2}" fo -20 ;-)

@Luc Hmm I did it for 9 points so maybe that's the reason. Will fix it, thanks!

@Luc neither my compiler nor TIO seem to work with the $"" format so I will stay put about it untill I can check it later on my main computer with newer VS. But thank you for the changes anyway!

@GrzegorzPuławski, oh, right... .NET Core :-) Haven't really played with it yet.

I think you should be able to save some bytes by doing 8/TimeSpan.TotalMinutes instead of 54e4/TimeSpan.TotalMilliseconds. Also, by a quick check using 'Math.Round(value,2)' instead of value.ToString("n2") seemed to save a few characters, partially because it needed fewer parentheses

@KamilDrakari It was already changed to Ticks instead of TotalMilliseconds. But thanks or the Math.Round tip!

Python 3, 74 bytes
from timeit import*;print('%.2f'%(480/timeit('input()',input(),number=8)))

Try it online!
This will give you silly numbers in TIO since it runs all the inputs at once but it does work.  timeit() returns the execution time of the statement 'input()' in seconds excluding the setup parameter input().
TIO with a 1s delay per input for validation.

Python + curses, 122 bytes
import curses as C,time as T
s=C.initscr()
C.cbreak()
t=0
exec's.getch();t=t or T.time()'*9
print'%.2f'%(540/(T.time()-t))

Requires the curses module to be loaded.
-9 bytes thanks to Felipe Nardi Batista

What's the curses module do? Curse you?

@MagicOctopusUrn Of course that's certainly what it does.

time() needs to start at first input and not at program execution.

@xNinjaKittyx fixed; thanks

@MagicOctopusUrn Jokes aside, it's a terminal-based GUI library.

i didn't test it, but import curses as C,time as T should save a byte, and i think you could do: exec's.getch();t=t or time();'*9 to save even more bytes

@FelipeNardiBatista Thanks!

C++, 150 bytes
#include<iostream>
#include<ctime>
#define G getchar()
void f(){G;auto s=clock();G;G;G;G;G;G;G;G;std::cout<<round(6000/(double(clock()-s)/8000))/100;}

You could save 5 bytes if you remove the #define and instead do void f(){for(int i=0,auto s=clock();i++<9;){getchar();}std::cout<<round(6000/(double(clock()-s)/8000))/100;}

No, because if i do that, timing will start before the first input, while it's said Timing starts at first input. Not start of program

Would it be possible to change line 3 to #define G;getchar() and then changing clock();G to clock()G?

@Zacharý I get syntax errors

For some reason, my compiler complains about round.

@Zacharý I almost forgot your comment here. What compiler do you use ? Since i tested with Visual C++, my compiler doesn't complain as long as i include iostream header.

I used the one on https://repl.it

vba, 57
msgbox"":x=timer:for i=1to 8:msgbox"":next:?480/(timer-x)

press enter, or click on the OK in the message box.

Java 8, 180 135 bytes
-45 bytes thanks to @SocraticPhoenix suggesting to use System.in directly.
x->{System.in.read();long t=System.nanoTime(),i=0;for(;i++<8;System.in.read());System.out.printf("%.2f",4.8e11/(System.nanoTime()-t));}

An anonymous lambda function with an unused argument that must be assigned to a functional interface method that throws an Exception (example below). Reads from console; beats are sent by pressing enter.
Ungolfed w/ Surrounding Test Code
public class A {
    interface F{void f(Object x) throws Exception;}

    public static void main(String[]a) throws Exception {
        F f =

        x->{
            System.in.read();
            long t=System.nanoTime(),i=0;
            for(;i++<8;System.in.read());
            System.out.printf("%.2f",4.8e11/(System.nanoTime()-t));
        }

        ;
        f.f(null);
    }
}

Would it be shorter to just read directly from System.in?

@SocraticPhoenix I've never actually tried that, but it seems to work; just using System.in.read() to block until input is received. Thanks! Will update answer.

25559105.43 bpm with this lol

R, 79 84 bytes
scan();s=Sys.time;x=s();replicate(8,scan());cat(round(60/as.numeric((s()-x)/8),d=2))

Only works when using enter, since that will end scan immediately. Explicitly uses print for its digits argument, handling the rounding.
> scan();s=Sys.time;x=s();replicate(8,scan());cat(round(60/as.numeric((s()-x)/8),d=2))
1:
Read 0 items
numeric(0)
1:
Read 0 items
1:
Read 0 items
1:
Read 0 items
1:
Read 0 items
1:
Read 0 items
1:
Read 0 items
1:
Read 0 items
1:
Read 0 items
[[1]]
numeric(0)

[[2]]
numeric(0)

[[3]]
numeric(0)

[[4]]
numeric(0)

[[5]]
numeric(0)

[[6]]
numeric(0)

[[7]]
numeric(0)

[[8]]
numeric(0)

[1] 439.47

Does this also round correct with a CPM greater than 1000?

@RomanGräf woops, nope. Edited.

C#, 117 bytes
There's already a C# (.NET Core) answer that this one builds on. Added interpolated string (that .NET Core seems to lack) for output and shaved some bytes by using long array instead of DateTime.
_=>{var d=new long[9];for(var i=0;i<9;){Console.ReadKey();d[i++]=DateTime.Now.Ticks;}return$"{48e8/(d[8]-d[0]):n2}";}

Humane version
class Program
{
    static void Main()
    {
        Func<int, string> f = _ =>
        {
            var d = new long[9];
            for (var i = 0; i < 9;)
            {
                Console.ReadKey();   // Switch these two to "automate" key presses.
                //Thread.Sleep(100);

                d[i++] = DateTime.Now.Ticks;
            }
            return $"{48e8 / (d[8] - d[0]):n2}";
        };

        var result = f(1);
        Console.WriteLine();
        Console.WriteLine(result);
        Console.ReadKey(true);
    }
}

Ruby, 58 bytes
gets;t=Time.now;8.times{gets};p (480/(Time.now-t)).round 2

source: Stack Exchange

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

sort: votes


text:
Repeat Repetitive Repetitions
Your challenge is to generate this string:
[encoded data, 15558 characters]

or split into lines with length of 80:
[encoded data, 15558 characters]
Notes:

You may return an array of the characters (or digits) of the string

You may use characters other than 0 and 1 if you want.

You can have other characters in the output, as long as, if filtered for your two chosen characters, would result in this pattern.

This string is generatable in way better ways than just hardcoding the whole string. A big part of the challenge is to find the shortest way to generate it. I've made a 16-byte SOGL answer that should be a language-agnostic algorithm (an old SOGL version specific 15-byte answer is what inspired the challenge), trough I'm not gonna post it (until someone finds that algorithm) to make the challenge more interesting for others.

This is code-golf, so the shortest answer (per language) wins!

Snippet to check the validness of an answer:

function check() {
  if (chr0.value == "") chr0.value = "0"
  if (chr1.value == "") chr1.value = "1"
  inp.value = inp.value.replace(new RegExp("[^"+JSON.stringify(chr0.value+chr1.value)+"]", "g"), "")
  if (inp.value == correct)
    output.innerHTML = "Matches"
  else
    output.innerHTML = "Doesn't match"
}
correct = "[encoded data, 15558 characters]"
<input id="inp" placeholder="input your result here"/><br>
<input id="chr0" placeholder="character for 0 (def=0)"/>
<input id="chr1" placeholder="character for 1 (def=1)"/><br>
<button id="chk" onclick="check()">check</button>
<div id=output></div>

Do you know if there are any better ways than base compression?

@EriktheOutgolfer Definitely, as this was made as a 15 byte accident :p A big part of the challenge is to find the shortest way to generate it.

Yeah, that's the reason I deleted my answer...felt not really worth it. Oh, and what you quoted is why I asked.

1 question: why?

@cairdcoinheringaahing I was playing around with an old SOGL version, then accidentally got that :p

This appears to be a primitive sequence, so it isn't a trivial repetition of anything unfortunately :(

Puzzling.SE meets codegolf.SE. Of course, when someone recreates the original method, it's just plain old golfing.

@Sanchises Well, then there's still the possibility to recreate something even golfier. ;)

Am I the only one that can't see the bits behind the scrollbar on the 90-chars-per-line split view?

@PatrickRoberts How many characters do you see fully?

@dzaima 89 characters on each line. The last one is mostly behind the scrollbar, rendered on Chrome in Windows 7

@PatrickRoberts yeah, Chrome does render the scrollbar over the characters. 87 should hopefully be fine for most browsers

I can only see 82 w/o scrolling.

@CalculatorFeline dammit browsers -_-

Probably the fact that I'm using my laptop (not that I use anything else for PPCG)

Wait doesn't Chrome add a horizontal scrollbar if the vertical scrollbar is rendered over characters?

Japt, 35 33 29 26 25 24 bytes
'1
#˜5s £=r1,26¤²²sX
s#ž

Try it online!
Explanation
'1   First line: Set variable U to this value.
'1   Yield the string "1". (This part gets simpler every time I golf this answer...)

1525s £=r1,26¤²²sX   Second line: Set variable V to this value (though that's not important).
1525s                Yield the string "1525".
      £              For each char X in this string:
           26¤         Yield the binary representation of 26. "11010"
              ²²       Double it twice.                       "11010110101101011010"
                sX     Slice off the first X chars. This gives "1010110101101011010",
                       "110101101011010", "010110101101011010", and "110101101011010".
       =               Set U to
        r1,              U with each instance of 1 replaced with the string calculated above.

s158   Last line: output the result of this line.
s158   Take U and slice off the first 158 characters.

Here's how I got this. Start with the original sequence:
01101011010110100110101101011010110101101011010011010110101101001101011010110101101011...

After some messing around, I realized that the sequence consisted entirely of copies of 0 and 11010. Replacing each instance of 11010 with 2 gave this:
02220222222022202222220222022222202220002220222222022202222220222022222202220002220222...

Oh hey, now it's entirely made of 0 and 222. Let's change each 222 to a single 2:
02022020220202202000202202022020220200020220202202022020020220202202022020002022020220...

This sequence looks an awful lot like the original. There seems to be a lot of 22020s in this, so I replaced each with 3 and got this:
02033300203330020333020333002033300203330203330020333000203330203330020333002033302033...

Now each instance of 3 is contained in a 020333. Replacing each of these again with a single 3 gives this:
30303303033030033030330303303003303033030330303303033030330300330303303033030033030330...

...and we're back to the original pattern again. One more time, replacing 33030 with 4:
30304404440444444044404444440444044444404440

Uh-oh, there's some stray chars at the beginning. We can fix this by adding an extra 3 at the beginning before condensing (this is where the 158 extra chars at the end comes from). Then we condense each run of 3 4s into a single 4, as before:
4040440404404044040

Aaaaand yet again, we're back to the original pattern. One last time, let's condense copies of 44040 to 5:
4040555

Hopefully this final step isn't too hard to understand. It's like the step where we compressed the 020333s into 3s, except this time, we're compressing 4040555s into 5s:
5

And there you have the fully compressed string. The code simply reverses the repeated compression to get back the original string. Since all compression iterations were nearly identical, it doesn't take much to reorganize the string properly.

As you can see here I've used Jelly's / (reduce)...does Japt have reduce/fold too? If so, that might save bytes.

@EriktheOutgolfer Japt does have reduce, but that would require changing £= to at least r@ if not something longer. (Honestly, £= is not a high price to pay for an unconventional reduce function)

You meant r@<space>? Of course then it would be something like [[1], 1, 5, 2, 5] instead of [1, 5, 2, 5] with using reduce.

Uh... no? (I'm on mobile ATM so apologies if I made a typo)

You didn't type r@  but markdown is a bit confusing that's why I asked...

@EriktheOutgolfer True. A space there would transpile to () though, which is a SyntaxError in JS

Would it be accurate to say you just reverse-engineered a fractal expansion?

@PatrickRoberts Yep, pretty much.

23 bytes

JavaScript (ES6), 130 bytes
Multicolor nonlinear pulse compression by consecutive optical parametric amplification in quasi-phase matched structures.
OK, not quite. Just substitutions.
f=(n=0,s='pqh0f9bc9bc9bc900')=>n<20?f(n+1,s.split((n+9).toString(36)).join('cb0dgfgnjkkoppo0qs10'[n]+'adcdef0hi0klmnqpqrs1'[n])):s

Demo

f=(n=0,s='pqh0f9bc9bc9bc900')=>n<20?f(n+1,s.split((n+9).toString(36)).join('cb0dgfgnjkkoppo0qs10'[n]+'adcdef0hi0klmnqpqrs1'[n])):s

o.innerHTML = f()
<pre id=o></pre>

How?
This is definitely not the best way to compress this string, but I thought I'd post it anyway since I went to the trouble of optimizing it (slightly) with a recursive function.
We start with the string s="pqh0f9bc9bc9bc900" and successively apply the following 20 substitutions:
 9  | a  | b  | c  | d  | e  | f  | g  | h  | i  | j  | k  | l  | m  | n  | o  | p  | q  | r  | s
----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----
 ca | bd | 0c | dd | ge | ff | g0 | nh | ji | k0 | kk | ol | pm | pn | oq | 0p | qq | sr | 1s | 01

For instance, a "9" will expand to "ca", "cbd", "c0cd", "dd0ddd", ..., and ultimately a 2381-character string of 0's and 1's.

Interesting technique, I'm sure it'd work well on strings with less pattern than this.

You lost me at "multicolor"

Retina, 69 66 65 bytes
Port of @ETHproduction's JavaScript (ES6) answer: Try it online! N.B. Somewhat slow.

1¶1010::010::
{`1(?=.*¶(\d*):)
$1ZZZ
Z
11010
}1`\d*:

^.{158}|¶

A port of @Jenny_mathy's Mathematica answer was 82 66 bytes: Try it online!

AAAY0PY0
A
Y0PY0PYP
Y
ZPZPZ
Z
P0P0
P
QQQR00
Q
R0RR0
R
XXX
X
01101

A port of @ETHproduction's Japt explanation was 69 bytes: Try it online!

5454545
5
4040
4
444
4
33030
3
020333
3
22020
2
222
2
11010
^.{158}

A port of @ETHproduction's previous Japt explanation was also 69 bytes: Try it online!

___101
_
10101
1
111
1
11010
1
___100
_
10110
1
111
1
11010
^.{157}

A port of @RickHitchcock's JavaScript answer was 74 bytes: Try it online!

ifififhg0
i
hhg
h
g0f
g
f0f0ff0f0ff0f0
f
e0e0e0ddd00
e
ddd0dddddd
d
01101

A port of @Arnauld's JavaScript answer was 85 bytes: Try it online!

pqh0g09bc9bc9bc900
9
cbd
b
0c
c
dd
d
gg0g0
g
nh
h
kkk0
k
0pppn
n
0pq
p
qq
q
s1s
s
01

Nice! can you please update mine? (this is my final version) thanx!

@Jenny_mathy I was able to golf off some more bytes so you're now the leading Retina port, thanks!

JavaScript (ES6), 85 80 bytes
[j="1",5,2,5].map(x=>j=j.replace(/1/g,"11010".repeat(4).slice(x)))&&j.slice(158)

Somewhat of a port of my Japt answer. An explanation of the pattern can be found over there.
Test snippet

var q = [j="1",5,2,5].map(x=>j=j.replace(/1/g,"11010".repeat(4).slice(x)))&&j.slice(158);

var o = "[encoded data, 15558 characters]";

console.log(q === o);

It's a bit confusing...until you find out j="1" is actually two things, one of them being type-abused.

Jelly, 28 22 20 bytes
⁽.⁷Dð26Bẋ4ṫȧ€Ẏð/ṫ159

Try it online!
-3 thanks to Jonathan Allan.
(Somewhat) port of ETHproductions's excellent Japt answer.
Still not efficient as dzaima's (old SOGL version)!
This returns an array of digits.

This has been checked for validity using Diff Checker!

Let us continue this discussion in chat.

Mathematica, 128 bytes
Fold[StringReplace,"AAAY0PY0",{{"A"->"Y0PY0PYP"},{"Y"->"P0P0PP0P0PP0P0"},{"P"->"QQQXXX00"},{"Q"->"XXX0XXXXXX0"},{"X"->"01101"}}]

Try it online!

Couldn't you make this shorter by using just one StringReplace and having a list of replacement rules?

yes of course...I just started golfing this down...

If the replacement is that easy then Retina should do well...

JavaScript (ES6), 158 143 139 bytes
(Saved some bytes thanks to @DanTheMan.)
'ifififhg0'[r='replace'](/i/g,'hhg')[r](/h/g,'g0f')[r](/g/g,'f0f0ff0f0ff0f0')[r](/f/g,'e0e0e0ddd00')[r](/e/g,'ddd0dddddd')[r](/d/g,'01101')

console.log('ifififhg0'[r='replace'](/i/g,'hhg')[r](/h/g,'g0f')[r](/g/g,'f0f0ff0f0ff0f0')[r](/f/g,'e0e0e0ddd00')[r](/e/g,'ddd0dddddd')[r](/d/g,'01101'));

You just need to generate the string, so you could drop the _=>.

This could be quite a bit shorter (at least 30 bytes). Hint #1: switch from .replace(/x/g,y) to .split(x).join(y)

Hint #2: Use digits > 1 in place of the letters in the compression. This will allow you to easily replace e.g. 9, then 8, then 7, etc.

@ETHproductions, I see how I can save 1 byte by switching to split and join with template strings:  'ifififhg0'[s='split']BTiBT[j='join']BThhgBT[s]BThBT[j]BTg0fBT (where BT is backtick)

Hint #3: map through an array of replacements, e.g. j='string',i=9,[replacements].map(x=>j=j.split(i--).join(x)),j

Thanks, @ETHproductions, I understand now.  Working on a program to find the shortest possible pattern in the string, but doubtful it will be shorter than yours.

05AB1E, 20 bytes
1Ž5ûv1₂b4×y.$.:]Ƶv.$

Try it online!
Port of ETHProductions's JAPT answer.

K (ngn/k), 86 bytes
@[&15558;+\(,/(,/(,/(1 5,,/(1_,/(11#5 6 6),\:5 5),\:4 5),\:9#3 2 3),\:2 2),\:1 2);:;1]

Try it online!

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


text:
Toggle the Box!
Given a string that is potentially boxed in, toggle the box. This becomes clearer in the test cases and explanation.
Input / Output
Input Format
The input will be either a single string separated by CR, LF, or CRLF, or a list of strings. The input format is up to you to decide.
Output Format
The output format must be in the same format as the input.
Explanation + Example
Let's take a boxed string as an example:
+-------------+
|Hello, World!|
+-------------+

To toggle the box, we remove the first and last row and the first and last column. You may assume that there will be no trailing whitespace after the last line (with an optional trailing newline at the end of the last line), and no trailing whitespace on any line, not counting the newline of course.
This would become:
Hello, World!

The Other Way
If the string is not in a box, add a box to it. This is fairly simple; prepend +---...---+ on its own line with k dashes where k is the length of the longest line, and then for each line, pad it with trailing whitespace to match the length of the longest line and then prepend and append a pipe character ("|"). Finally, append a line containing the same +---...---+ setup as the first line.
For example:
Hello, World!

becomes:
+-------------+
|Hello, World!|
+-------------+

You may assume that none of the lines in the input will have trailing whitespace.
Another example of a string that should have a box put around it:
Hello,
    World!

becomes
+----------+
|Hello,    |
|    World!|
+----------+

An example of something that should still be boxed:
+--------+
|        |
 --------+

becomes:
+----------+
|+--------+|
||        ||
| --------+|
+----------+

Rules + Specifications

Standard Loopholes Apply
No line of input will have any leading or trailing whitespace both overall and in each line, regardless of whether or not it has been boxed in
Boxes will only have + as their corners and | for the vertical edges and - for the horizontal sides.
A box must have its pluses in place to be considered a box; if it has height or width 2 (that is, no content), it should still be unboxed, which would result in a bunch of newlines, depending on the height of the box.
If the input has a box but text outside of the box, the whole thing should be boxed.
Your program must check the entire perimeter of the string. If a single character along the outside is not correct (either missing or a different character than what it should be), then it should be boxed, not unboxed.
The unboxed string itself may contain + | -. If the unboxed string itself has a box around it, return the string with the box; it should only be unboxed once.

Edge Cases
1: Small boxes
Input:
++
++

Output is a empty or a newline
Input:
+----+
+----+

Output is empty or a newline
Input:
++
||
||
++

Output is 2 newlines or 3 newlines
2: Partial Box
Input:
+-------+
| Hello |
+ ------+

Output:
+---------+
|+-------+|
|| Hello ||
|+ ------+|
+---------+

3: Text outside of box
Input:
 +-------+
a| Hello |
 +-------+

Output:
+----------+
| +-------+|
|a| Hello ||
| +-------+|
+----------+

"No line of input will have any leading or trailing whitespace both overall and in each line, regardless of whether or not it has been boxed in." Several of your test cases have leading whitespace. Would rectangular input be too much to ask?

@Neil He probably meant no consistent leading whitespace, i.e. each line starting with 3 spaces wouldn't be a case but lines starting with 1, 2, 0, 3 spaces would since those aren't consistent.

Is this a box or not?

@Cowsquack From the spec it seems it isn't.

@Neil Sorry, I mean that any spaces at the beginning would render it as not a box.

Like, there might be extra whitespace if there's text outside of the box.

@Cowsquack No it isn't.

JavaScript (ES2017), 199 bytes
s=>/^\+-*\+\n(\|.*\|\n)*\+-*\+$/.test(s,s=s.split`
`,s.map(z=>z[y]?y=z.length:0,y=0))?s.slice(1,-1).join`
`.replace(/.(.*)./g,"$1"):(x=`+${'-'.repeat(y)}+`)+`
|${s.map(z=>z.padEnd(y)).join`|
|`}|
`+x

The naive solution. May or not be the best, we'll see...

"May or not be the best, we'll see..." still it's cool to see a non-golfing language such as JS to solve this in <200 bytes...see what I did there? ;)

Haha, sounds like a commercial for something "now under 2 dollars!" when it costs 1.99 :P

That's called industrial robbery lol.

This works for the test cases, but I don't think it works for something like this:  '+--+\n|hi|\n|world|\n+----------+'.  It removes the lines, even though it's not rectangular.

SOGL V0.12, 72 bytes
2-┌* +1Ο;2-⁴┌@ŗΖ+|ŗ∙⁴++B
▓Aa1w⁄;lGB╬8a⁰I{_=}¹χ?ajk{jk}⁰←a1w⁄;l2+G2+B00╬5

Try it Here!
+7 bytes (⁰I{_=}¹χ) because elementwise equals isn't implemented
+1 byte (▓)because input isn't guaranteed to be square
+1 byte (A) for me being lazy and not implementing typed inputs (so this expects input on the stack. For ease-of-use, the online link includes → so the input box can be used)

⁰I{_=}¹χ is +8 bytes not +7.

@EriktheOutgolfer well the replacement should be =, but as that doesn't work, it changes length by -1+8 = +7

Jelly, 46 bytes
ẋ2jÐ€
z©⁶”|çZṖ”-çµḢ⁾-+yWWçWẎZ
ḊṖZḊṖÇ
Ỵ®2ĿÇ⁼$?Y

Try it online!

Um this transposes (zips) the input when making it rectangular

@HyperNeutrino I don't remember it doing that when I answered...

Retina, 197 195 bytes
+m`^((.)*)(¶(?<-2>.)*(?(2)$|(.)))
$1$#4$* $3$#2$*
%`^|$
|
^.(.*).
+$.1$*-+¶$&
.(.*).$
$&¶+$.1$*-+
^(\+-*\+)¶(\|\+-*\+\|)¶(\|\|.*\|\|¶)*\2¶\1$
¶$&¶
..(.*)..(?=(.|¶)*¶$)
$1
^¶-*¶-*¶|(\G|¶)-*¶-*¶$

Try it online! Explanation:
+m`^((.)*)(¶(?<-2>.)*(?(2)$|(.)))
$1$#4$* $3$#2$*

This stage is quite complicated in itself, so I'll break it down a bit. + means that the stage repeats until no more replacements can be found. m`^ means that the stage matches at the start of any line. ((.)*) then matches the whole line. Now $1 is simply the matched line, but $2 is a list of matches i.e. characters. (¶ then matches the end of the line and therefore the start of the next line. (?<-2>.)* uses a .NET balancing group. The <-2> removes matches from $2 as long as a character can be matched on the second line. At this point, one of three things can happen:

There weren't enough characters on the second line. $2 still has some matches left.
The two lines were exactly the same length. $2 has no matches left, and we are at the end of the line.
The second line is longer, so there is at least one character left over.

(?(2)$|(.))) helps distinguish these using a condition. If $2 still has some matches left, then we need this to be because the second line is too short, so we match the end of the line, but if $2 has no matches left, then we want the second line to be longer, so we match a character (which goes into $4 so that we know that the match happened). Otherwise the two lines are the same length and the match fails at this point (it might match again at a later line of course).
The replacement string is $1$#4$* $3$#2$*. The $#4 evaluates to 1 if we matched an additional character on the second line, 0 if not. This means that $#4$* adds a space to the first line if the second line was longer. Similarly $#2$* adds spaces to the second line if the first line was longer. (In fact, it ends up adding exactly the right number of spaces. If we were only balancing two lines, a + could have been added to the fourth capture group to achieve this directly for the case of the longer second line too.)
The upshot of all this is that this stage pads out the input into a rectangle. We can now draw a box around it.
%`^|$
|

Place |s on each side.
^.(.*).
+$.1$*-+¶$&

Place +-...-+ on the top.
.(.*).$
$&¶+$.1$*-+

And again on the bottom.
^(\+-*\+)¶(\|\+-*\+\|)¶(\|\|.*\|\|¶)*\2¶\1$
¶$&¶

See if we've created a double box. If so, extra blank lines are added at the top and bottom for the remaining stages to match to delete both boxes.
..(.*)..(?=(.|¶)*¶$)
$1

If there's a trailing blank line, remove two characters from the start and end of every line.
^¶-*¶-*¶|(\G|¶)-*¶-*¶$

If there's a leading blank line, delete it and the next two lines (which will be the -s remaining at the top of the box). If there's a trailing blank line, delete it and the previous two lines. The (\G|¶) deals with the case where there's only six lines (and therefore 5 ¶s) because the box had no content.