[Question]
  [
| [Ken Iverson, 1920–2020](https://www.youtube.com/watch?v=3wSSCYUd4z4 "A distinguished panel of contributors remember Ken Iverson and discuss the future of his revolutionary notation.") |
| --- |
| [(0,x)-(x,0)](https://www.youtube.com/watch?v=3wSSCYUd4z4 "A distinguished panel of contributors remember Ken Iverson and discuss the future of his revolutionary notation.") |
Let's implement [his favourite expression](https://www.dyalog.com/blog/2014/12/ken-iversons-favourite-apl-expression/):
### Given a row of [Pascal's triangle](https://en.wikipedia.org/wiki/Pascal%27s_triangle), compute the next row.
This can for example be computed by taking the input padded with a zero on the left, and the input padded with a zero on the right, and then adding the two element-by-element.
### Test cases
`[1]` → `[1,1]`
`[1,1]` → `[1,2,1]`
`[1,2,1]` → `[1,3,3,1]`
`[1,10,45,120,210,252,210,120,45,10,1]` → `[1,11,55,165,330,462,462,330,165,55,11,1]`
`[1,50,1225,19600,230300,2118760,15890700,99884400,536878650,2505433700,10272278170,37353738800,121399651100,354860518600,937845656300,2250829575120,4923689695575,9847379391150,18053528883775,30405943383200,47129212243960,67327446062800,88749815264600,108043253365600,121548660036300,126410606437752,121548660036300,108043253365600,88749815264600,67327446062800,47129212243960,30405943383200,18053528883775,9847379391150,4923689695575,2250829575120,937845656300,354860518600,121399651100,37353738800,10272278170,2505433700,536878650,99884400,15890700,2118760,230300,19600,1225,50,1]` → `[1,51,1275,20825,249900,2349060,18009460,115775100,636763050,3042312350,12777711870,47626016970,158753389900,476260169700,1292706174900,3188675231420,7174519270695,14771069086725,27900908274925,48459472266975,77535155627160,114456658306760,156077261327400,196793068630200,229591913401900,247959266474052,247959266474052,229591913401900,196793068630200,156077261327400,114456658306760,77535155627160,48459472266975,27900908274925,14771069086725,7174519270695,3188675231420,1292706174900,476260169700,158753389900,47626016970,12777711870,3042312350,636763050,115775100,18009460,2349060,249900,20825,1275,51,1]`
  
[Answer]
# [APL (Dyalog Unicode)](https://www.dyalog.com/), 7 [bytes](https://github.com/abrudz/SBCS)
```
+∘⌽⍨0,⊢
```
[Try it online!](https://tio.run/##SyzI0U2pTMzJT/9vpK1voKPzqGOGAZfGo5692o@6Fmka6ADJ/9pAQaDIo94VEH7ao7YJj3r7HnU1H1pv/Kht4qO@qcFBzkAyxMMz@H@agqGCqYKhAQgBaQA "APL (Dyalog Unicode) – Try It Online")
Prepend a zero, and add the mirrored array:
```
1 4 6 4 1
→ 0 1 4 6 4 1 + 1 4 6 4 1 0
→ 1 5 10 10 5 1
```
# [APL (Dyalog Unicode)](https://www.dyalog.com/), 7 [bytes](https://github.com/abrudz/SBCS)
```
0∘,+,∘0
```
[Try it online!](https://tio.run/##SyzI0U2pTMzJT///3@BRxwwdbR0gafA/7VHbhEe9fY@6mg@tN37UNvFR39TgIGcgGeLhGfw/TcFQwVTB0ACEgDQA "APL (Dyalog Unicode) – Try It Online")
Just realized that the straightforward translation of Iverson's expression is short enough.
# [APL (Dyalog Extended)](https://github.com/abrudz/dyalog-apl-extended), 5 bytes
```
…⍤≢!≢
```
[Try it online!](https://tio.run/##SyzI0U2pTMzJT9dNrShJzUtJTflvpK1voKPzqGOGAZfGo5692o@6Fmka6ABJLm2gIFDkUe8KMP//o4Zlj3qXPOpcpAjE/9MetU141Nv3qKv50HrjR20TH/VNDQ5yBpIhHp7B/9MUDBVMFQwNQAhIAwA "APL (Dyalog Extended) – Try It Online")
Ignore the content, take the length (n) and evaluate all binomials from nC0 to nCn. In APL, nCk is `k!n`, and `…n` gives `0..n`.
[Answer]
# [Python 2](https://docs.python.org/2/), 34 bytes
```
lambda l:map(sum,zip(l+[0],[0]+l))
```
[Try it online!](https://tio.run/##K6gsycjPM/qfZhvzPycxNyklUSHHKjexQKO4NFenKrNAI0c72iBWB4i1czQ1/xcUZeaVKKRpZOYVlJZoAAWiDXUMDXRMTHUMjQx0jIBMI1MjMA3ig4SBrFgA "Python 2 – Try It Online")
**37 bytes**
```
lambda l:map(int.__add__,l+[0],[0]+l)
```
[Try it online!](https://tio.run/##K6gsycjPM/qfZhvzPycxNyklUSHHKjexQCMzr0QvPj4xJSU@XidHO9ogVgeItXM0/xcUAaUU0oAKCkpLNDQ1/0cb6hga6JiY6hgaGegYAZlGpkZgGsQHCQNZsQA "Python 2 – Try It Online")
# [Python 2](https://docs.python.org/2/), 38 bytes
```
p=0
for x in input()+[0]:print x+p;p=x
```
[Try it online!](https://tio.run/##K6gsycjPM/r/v8DWgCstv0ihQiEzD4gKSks0NLWjDWKtCooy80oUKrQLrAtsK/5DeGkaUBWa/6MNdQwNdExMdQyNDHSMgEwjUyMwDeKDhIGsWAA "Python 2 – Try It Online")
# [Python 3.8 (pre-release)](https://docs.python.org/3.8/), 37 bytes
```
lambda l,p=0:[p+(p:=x)for x in l]+[1]
```
[Try it online!](https://tio.run/##HYjBCoQgFEV/xeWL3kJtggj8EnPh0EiC2UMs7Osd62zuuYfuvB1xmChVp5Ya7P5dLQtIis@aeqBZlc4diRXmIwum18JUSj5mcPC7bAAf6czQNaoWKDh@RhSSo2wqR/nu85/czPwB "Python 3.8 (pre-release) – Try It Online")
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 2 [bytes](https://github.com/DennisMitchell/jelly/wiki/Code-page)
```
Ż+
```
A monadic Link accepting a list of integers which yields a list of integers.
**[Try it online!](https://tio.run/##y0rNyan8///obu3///9HG@oYGuiYmOoYGhnoGAGZRqZGYBrEBwkDWbEA "Jelly – Try It Online")**
### How?
Pretty simple in Jelly to go with the method given in the OP, although we do not need to right-pad with a zero since it is implicit in vectorised addition:
```
Ż+ - Link: list, R           e.g. [ 1, 4, 6, 4, 1]
Ż  - prepend a zero (to R)        [ 0, 1, 4, 6, 4, 1]
 + - addition (vectorises)        [ 1, 5,10,10, 5, 1]
```
[Answer]
# [Factor](https://factorcode.org/), 27 bytes
```
[ 0 suffix dup reverse v+ ]
```
[Try it online!](https://tio.run/##ZVJNTxtBDL3nV/iOhPwxnrHpD6i4cEE9IQ4RnaiIkobdTVSE@O3Bsynp7nIYzRvbYz/7ebN@GP50xx@31zffr@Cpdtv6G/r6sq/bh9rD83r4dXmoLaaHXVeH4XXXPW4H@LZavcEKAN6A4P2MAn9Cnj4IISkQI3BAVh7v9m5mnIZqs3NYPWOECkq7iKzk8Kg5ljC4m6UUQCVbsawtK2oSaV5CLszFqCBIEY1j1uxM4p6VKB6iyTIqWavjUixp1jxWi1TGrkVHhs5Rw7NrGMAtFSkuTtSYGqoom5mUcAomVA8SJhx5UiF2jm6SRDOQi3BJKWPmRsasJDdSzimPnA2TsIoEixPXRjCgjKQo4gjjc2ql@Kt/8X@RflF8QW1BfNHWvOf5POazmo1xNuD56KeaTLSaSPhf17PUZ/E/t@Hfcpw2ZVwaPa3S@@p4Bwj9frN5/As/9zvo6qF2fYXDBdwfn9c7uDx@AA "Factor – Try It Online")
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E/wiki/Commands), ~~5~~ 4 [bytes](https://github.com/Adriandmen/05AB1E/wiki/Codepage)
```
0šÂ+
```
[Try it online](https://tio.run/##yy9OTMpM/f/f4OjCw03a//9HG@oY6RjGAgA) or [verify all test cases](https://tio.run/##ZVI7TgNBDL1KlJYp/P9UOUiUAiQKKgokpLQUHIAbcBbERXKRxd6EkF2K3fE8e@xnPz@/3D88PU6vx912c3r/2Gx3xwm@P7/e7qYx7fd4GHsc5z9dToQhOpBgUJmkNJ99bxguUdoQFZAGFcXAfSCGW3k0EryAzAiRMpQtPEw7IagwtxeBnMgDHQY7a30RjRNypiliXVglDBSj6yR7iJraXK1SBaW6zuSSqkZaagEjQ5w9ORGbaYCyUkSwl5NBQLNIBFPlEUdKqm6Eq5lhzuQiBkZNJsIlA5VMbOYcIEzKXCzOXJtgmTyTwopDqMfSpei/f/V@lX5VfEVtRXzV1rLn5TyWs1qMcTHg5ehvNbnR6kbCP12vUl/F/92Gy3KcN2VempbkcPgB).
Or alternatively:
```
0š+Ć
```
-1 byte thanks to *@ovs*.
[Try it online](https://tio.run/##yy9OTMpM/f/f4OhC7SNt//9HG@oY6RjGAgA) or [verify all test cases](https://tio.run/##ZVI7TgNBDL1KlJYp/P9UabhFlAIkCioKJKRcIAfgBtwFLsJFFnsTQnYpdsfz7LGf/fzy@vD4/DS9HXfbzffpfbPdHe8n@Pq4@zxNY9rv8TD2OM5/upwIQ3QgwaAySWk@@94wXKK0ISogDSqKgftADLfyaCR4AZkRImUoW3iYdkJQYW4vAjmRBzoMdtb6Ihon5ExTxLqwShgoRtdJ9hA1tblapQpKdZ3JJVWNtNQCRoY4e3IiNtMAZaWIYC8ng4BmkQimyiOOlFTdCFczw5zJRQyMmkyESwYqmdjMOUCYlLlYnLk2wTJ5JoUVh1CPpUvRf//q/Sr9qviK2or4qq1lz8t5LGe1GONiwMvR32pyo9WNhH@6XqW@iv@7DZflOG/KvDQtyeHwAw).
Or yet another alternative (thanks to *@ovs*):
```
gDÝc
```
[Try it online](https://tio.run/##yy9OTMpM/f8/3eXw3OT//6MNdYx0DGMB) or [verify all test cases](https://tio.run/##ZVI7TgNBDL1KlHoK/z9VGm4RpQCEEBUFElIuwAHoOQ03yUUWexNCdil2x/PssZ/9/Pp2//DyNL0fd9vN6eNzs90dp@e776/HaUz7PR7GHsf5T5cTYYgOJBhUJinNZ98bhkuUNkQFpEFFMXAfiOFWHo0ELyAzQqQMZQsP004IKsztRSAn8kCHwc5aX0TjhJxpilgXVgkDxeg6yR6ipjZXq1RBqa4zuaSqkZZawMgQZ09OxGYaoKwUEezlZBDQLBLBVHnEkZKqG@FqZpgzuYiBUZOJcMlAJRObOQcIkzIXizPXJlgmz6Sw4hDqsXQp@u9fvV@lXxVfUVsRX7W17Hk5j@WsFmNcDHg5@ltNbrS6kfBP16vUV/F/t@GyHOdNmZemJTkcfgA).
**Explanation:**
```
     # (example input: [1,2,1])
0š   # Prepend a 0 to the (implicit) input-list
     #  STACK: [0,1,2,1]
  Â  # Bifurcate the list; short for Duplicate & Reverse copy
     #  STACK: [0,1,2,1], [1,2,1,0]
   + # Add the values at the same positions in the two lists together
     #         [0+1,1+2,2+1,1+0]
     #  STACK: [1,3,3,1]
     # (after which the result is output implicitly)
0š   # Prepend a 0 to the (implicit) input-list
     #  STACK: [0,1,2,1]
  +  # Add the values at the same positions in the two lists together, where the second
     # list is the (implicit) input (because the two lists are of different lengths,
     # the trailing item is ignored)
     #         [0+1,1+2,2+1]
     #  STACK: [1,3,3]
   Ć # Enclose; append its own first item as additional trailing item
     #  STACK: [1,3,3,1]
     # (after which the result is output implicitly)
g    # Get the length of the (implicit) input-list
     #  STACK: 3
 D   # Duplicate this length
     #  STACK: 3,3
  Ý  # Push a list in the range [0,length]
     #  STACK: 3,[0,1,2,3]
   c # Calculate the binomial coefficient between the length and each value in this list
     #  STACK: [1,3,3,1]
     # (after which the result is output implicitly)
```
[Answer]
# [Haskell](https://www.haskell.org/), ~~26~~ 25 bytes
```
o l=zipWith(+)(0:l)l++[1]
```
[Try it online!](https://tio.run/##y0gszk7Nyfn/P18hx7YqsyA8syRDQ1tTw8AqRzNHWzvaMPZ/bmJmnoKtQkFRZl6JgopCfrShjpGOYSyXAgr4DwA "Haskell – Try It Online")
* Saved 1 thanks to @ovs
* New approach, it essentially do this:
```
 0[1,2,1] +
[1,2,1]    =
[1,3,3] + 1
```
Previous version 30 bytes
```
o=(0#)
x#(v:w)=x+v:v#w
x#_=[x]
```
[Try it online!](https://tio.run/##y0gszk7Nyfn/P99Ww0BZk6tCWaPMqlzTtkK7zKpMuRzIj7eNroj9n5uYmadgq1BQlJlXoqCikB9tqGOkYxj7HwA "Haskell – Try It Online")
[Answer]
# [convey](http://xn--wxa.land/convey/), ~~[13](https://codegolf.stackexchange.com/revisions/241498/1)~~ ~~[12](https://codegolf.stackexchange.com/revisions/241498/3)~~ 10 bytes
```
{,"0
0.>+}
```
[Try it online!](https://xn--wxa.land/convey/run.html#eyJjIjoieyxcIjBcbjAuPit9IiwidiI6MSwiaSI6IlsxLDMsMywxXSJ9)
[![Program running on 1 4 6 4 1](https://i.stack.imgur.com/Im4eu.gif)](https://i.stack.imgur.com/Im4eu.gif)
[Answer]
# R 4.1, 17 bytes
Only posting because because the function nicely resembles the APL expression.
```
\(x)c(x,0)+c(0,x)
```
[Answer]
# [brainf\*\*\*](https://esolangs.org/wiki/Brainfuck), 41 bytes
```
>>>,[>>,]<<[<<]>>[[-<+>>+<]>>]<[<<]>>[.>>]
```
[Takes input as character codepoints.](https://codegolf.meta.stackexchange.com/a/18027/98140)
Unfortunately, control characters are currently cancelled on most PC's, so I cannot give a legitimate test case in TIO or any other implementation of brain. : /
# How?
```
>>,[>>,]<<[<<]                                  # Store the input on every other cell
               >>[       ]>>]                   # For every number in the input
                  -<+>>+<                       # Distribute the number to adjacent cells                                                                                                          Nothing here...
                             <[<<]>>[.>>]       # Output each sum
```
---
Probably my last post of 2020.
[Answer]
# [MATL](https://github.com/lmendo/MATL), 4 bytes
```
TTY+
```
[**Try it online!**](https://tio.run/##y00syfn/PyQkUvv//2hDHUMDHRNTHUMjAx0jINPI1AhMg/ggYSArVgEA "MATL – Try It Online")
### How it works
This convolves the input with `[1, 1]`.
[Answer]
# [K (oK)](https://github.com/JohnEarnest/ok), ~~8~~ 6 bytes
-2 bytes thanks to Adám!
```
+':|0,
```
[Try it online!](https://tio.run/##y9bNz/7/P81KW92qxkDnf5q6hqG1oQIIG4FJQwMFE1MFQyMDBSMg08jUCEyD@CBhIEvzPwA "K (oK) – Try It Online")
# [J](http://jsoftware.com/), ~~9~~ 7 bytes
-2 bytes thanks to xash!
```
0&,+,&0
```
[Try it online!](https://tio.run/##ZVK7TgNBDOzzFRZFIkSI/H4gUSFRUfELiAjR8P/V4b1AuDuK1XrHXnvs8ed0czqc4fEBDnAEhIc@9yd4en15nnB/vDvucbrdwe797eMLzkBXY2nyCkdQA2IEbpON53u8B4zLUBs4N1qOHSoo4yLK8PZYFkYDVZmqbZh4RrqNrGgqMryEHMyRFAgSYn0yB84kVW5E/RDTdDTKUackUs3N52qdKrksbGZY3DXKyxqASg2JkiIaTBNNjDNTop2CilZNIoU7jwZxcXej0s2Ah3CoOjoPMpmhlWTs6jPnRBU2kWZx4ToItikzKeo4wv6soxT/92/@b9Jvim@obYhv2lr3vJ7HelarMa4GvB79UpOFVgsJ/3S9Sn0V/3cbfpbjsinz0gxJYPoG "J – Try It Online")
Both translated from [Bubbler's APL solution](https://codegolf.stackexchange.com/a/216484/75681) - don't forget to upvote it!
[Answer]
# **PowerShell, 30 27 bytes**
-3 bytes thanks to mazzy
```
($x=$args+0)|%{$_+$x[--$i]}
```
Explanation:
```
 ($x=$args+0)|%{$_+$x[--$i]}
 ($x=                          #assign to $x
     $args+0)                  #the input array with a 0 appended
             |                 #pipe the result of the assignment
              %{           }   #for each item in the piped input
                $_+            #add to that item
                   $x[    ]    #the item of x
                      --$i     #with index equal to the decrement of i.
                               #negative indices in powershell index from
                               #the end of the array, so -1 is the last item
                               #in the array, -2 is second to last, etc.
                               #implicitly output
```
[Answer]
# [Nibbles](https://nibbles.golf), 4 bytes (8 nibbles)
```
!:0$:@0+
```
## Verbose
```
!   # Zip
  : 0 $   # Prepend 0 to argument
  : @ 0   # Append 0 to argument
  +   # With addition
```
[Answer]
# JavaScript (ES6), 29 bytes
Returns a comma-separated string.
```
a=>a.map(v=>p+(p=v),p=0)+[,1]
```
[Try it online!](https://tio.run/##dctLCoAwDATQvSdpMUobdBkvIl0Efyhqg0qvXz9L0dXMPJiJA@/NNsqRrb7tYk@RqeJ8YVGBKkmVUNAgZHRag3Wx8evu5y6f/aB6VVundfI2@Fb8cWugKMGiAbwqlvjkvW82zyue "JavaScript (Node.js) – Try It Online")
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 4 bytes
```
Ż+Ṛ$
```
[Try it online!](https://tio.run/##ZVK7UQNBDG3GGRvo/ymF8TgkYdwAKQk5EUMNNOAhZFyIaeSQzsb4juButU9a6UlPjw/7/dM0HT/vTof3zfT1cnw9Hd42388f99O0xd3Y4jj/6XIiDNGBBIPKJKX57HvDcInShqiANKgoBu4DMdzKo5HgBWRGiJShbOFh2glBhbm9COREHugw2Fnri2ickDNNEevCKmGgGF0n2UPU1OZqlSoo1XUml1Q10lILGBni7MmJ2EwDlJUigr2cDAKaRSKYKo84UlJ1I1zNDHMmFzEwajIRLhmoZGIz5wBhUuZicebaBMvkmRRWHEI9li5F//2r96v0q@Iraiviq7aWPS/nsZzVYoyLAS9Hf6vJjVY3Ev7pepX6Kv7vNlyW47wp89K0JLsf "Jelly – Try It Online")
~~Rip off~~ Translation of Razetime's Husk solution, so be sure to send some upvotes his way.
[Answer]
# [R](https://www.r-project.org/), 21 bytes
```
c(0,x<-scan())+c(x,0)
```
[Try it online!](https://tio.run/##K/r/P1nDQKfCRrc4OTFPQ1NTO1mjQsdA87@hgqGBgompgqGRgYIRkGlkagSmQXyQMJD1HwA "R – Try It Online")
[Answer]
# [Wolfram Language (Mathematica)](https://www.wolfram.com/wolframscript/), 29 bytes
```
Tr/@Partition[#,2,1,{2,1},0]&
```
[Try it online!](https://tio.run/##ZVI9a8NADN37KwqFTgfV50kaCvkJGbqFDKaU1ENaCN5Cfrurc9rUdgb7Tno66UlPx274/Dh2Q//ejYfX8e30stl2p6Ef@u@v3VOhguWcv0uB/fO4PfVfw@PmsDvjZf8ws8rapjsPQhEtSFAor6Q0nc1ubriL1wZSQlEh4xm4HYhuNRH1AEtHhLtIXpSrm1dtqUGFuaEIZETmaFDYWPNzb35CjqiKmAareAVFb3WCzUWr1qlapnIKNZ1oBmWNqKHpKOFibMGB2Jg6KCu5O1uCDAIaScKZMo8YUlB2I5zNlGpMJlKhUiPjbhKOSlXqxNlBmJQ5WVy5NoJ55YkUZhxCPpZWiu7x1ftV@lXxFbUV8VVby56X81jOajHGxYCXo59rMtNqJuG/rjepb@L/bcPvclw3ZVoave7TOP4A "Wolfram Language (Mathematica) – Try It Online")
-3 bytes from @att
[Answer]
# [Vyxal](https://github.com/Lyxal/Vyxal), 3 bytes
```
0p+
```
[Try it Online!](http://lyxal.pythonanywhere.com?flags=&code=0p%2B&inputs=%5B1%2C2%2C1%5D&header=&footer=)
```
    # Implicit input
0p  # prepend 0
  + # (Implicit input) add (vectorised)
```
[Answer]
# [brainfuck](https://github.com/TryItOnline/brainfuck), 20 bytes
Character codepoints are used as input and output.
```
,[[<+>>+<-]<.>>>,]<.
```
[Try it online!](https://tio.run/##ZU5NS8QwFLz3Vwyl0MRNu@4HnrK56dUfEHpo05TElSTEFFfwv9dsXfUgPN7M8Jg3M/RvZlF9goDyo26HCZzj8flpYVLyjRAb3nS8FUKwDEs@FMW7sa8aUfcjrAtzKkZfAH5OmZ8qEj6S8e6ARqEM0bpEtBtPdd2@eOuIMpFcKCYfccl2VOsLSkt8YutD2g6xt26a1fmP/VSjOUYr49E4lNV34NX3P1He@aAduWd1HGraXrsS2tEyV3V6kbuukDuGG@x/2WGdmzgyPKw76y8 "Bash – Try It Online")
Input is taken in every second cell and added to both surrounding cells. This leaves the output in every other cell.
Example run with input `[1, 2, 1]`:
```
0 0 0 0 0 0 0   The tape is initially filled with 0's
0 1 0 0 0 0 0   ,
  ^             Read the first input into this cell
1 0 1 0 0 0 0   [<+>>+<-]
^   ^           Add the value to both surrounding cells
                <.> and print the cell left to the input
1 0 1 2 0 0 0   >>,
      ^         Move right by 2 cells and take the next input
1 0 3 0 2 0 0
    ^   ^
1 0 3 0 2 1 0
          ^     ...
1 0 3 0 3 0 1
        ^   ^
1 0 3 0 3 0 1
^   ^   ^   ^   The outputs are in these cells
                The trailing <. prints the last output
```
[Answer]
# [Ruby 2.7](https://www.ruby-lang.org/), 26 bytes
*A port of [Arnauld's answer](https://codegolf.stackexchange.com/a/216482/83605) in Ruby.*
```
->a,i=0{a.map{i+i=_1}+[1]}
```
[Try it online!](https://tio.run/##dVPLbhsxDLz3K3LPthDf5MH9kcCH9BAghwJB2xQokny7O5Ibe6WgNuyVSIkczsz@eP725/RwOH3@er89HtrL/Zfv908vr79fH28fD7/fbu/o@HZ6ev718@bhDuvjzeFwc0cbHT9dgts1zHOCdynBd77VNrWNuG2MJRuPZ9/3cNtdJdoMIbdNBFnn8evrHuupBZD1Oox4eUNpadIfRBmOjGW1QKAqUxULE89It46imYr0LDUO5kiKtkmI4ZfZ40xS5UaEjZimN6PsfUoi1dx8dEOp5LKwMVExepSXIbBVakiUFFFHms3EODMlkJSmzQogUhh1NIiLMY0Khtk8hEPVm3MHkxlaScauPjBnU2ETAYoz1g4QSxmgCOeo4bL2Vvwxv9xfyi/NF2gL8GWseeaZj5mricaJ4Jn6vSY7rXYSXnW9SH0R/90N/8xxdsowje2tZ3AWd4gAiH@tGobSaj5GbKV9QYYZOyoXDwC3QQcLsQwvBj69YSfN2Rt5xQAT4DpH0V2i3yiO5gT6@6iU6dBLSMFPIGo08gWLKypj1XCiIwxcwAY6FbYKJkvBjaOubQApRmbOQQO2gmi3lObnN8NbBDt1mc@kQLHmiYl4eLqsqEi00eBBAwHUVhzv7@@6X86v9T70W/AscJdhllEXImaWZgZndmfi/yPJpOFO2qveVw9cbPHuk3fbDA8NO3VbHU9/AQ "Ruby – Try It Online")
---
# [Ruby](https://www.ruby-lang.org/), 33 bytes
```
->a{(a+[0]).zip([0]+a).map &:sum}
```
[Try it online!](https://tio.run/##dVPLbhsxDLz3K3wqEmQbiG@yQPojhg/uIUAPAYKmObRFv90dyY29q6A27JVIiRzOzH5//frz9Phw@vTl@PvmeLdvh9v7X9@eb7C4O97ePx2fdx8/v7w@/Tk9v/542T3u93Q47B4ednta6PDhElyuYd4meJUSfLe32qK2ELeFsWTj8ez7Hm6rq0SLIeS2iCDrPH593WM9NQGyXocRL28oLU36gyjDkbGsFghUZapiYeIZ6dZRNFORnqXGwRxJ0RYJMfwye5xJqtyIsBHT9GaUvU9JpJqbj24olVwWNiYqRo/yMgSWSg2JkiLqSLOZGGemBJLStFkBRAqjjgZxMaZRwTCLh3CoenPuYDJDK8nY1QfmbCpsIkBxxtoBYikDFOEcNVzW3orf56f7U/mp@QRtAj6NtZ15y8eWqw2NG4K31K81WWm1kvCq60Xqi/hvbvhnjrNThmlsbT2Ds7hDBED8a9UwlFbzMWIr7QsyzNhRuXgAuA06WIhleDHw6Q07ac7eyCsGmADXOYquEv1GcTQn0N9HpUyHXkIKfgJRo5EvWFxRGauGEx1h4AI20KmwVTBZCm4cdW0BSDEycw4asBVEu6U0P78Z3iLYqct8JgWKNU9MxMPTZUVFoo0GDxoIoLbieH9/5/10fq73rt@EZ4I7DTONOhGxZWnL4JbdLfH/kWSj4Uraq95XD1xs8eaTN9sMDw07dVsdTn8B "Ruby – Try It Online")
[Answer]
# [Husk](https://github.com/barbuz/Husk), 4 bytes
```
Sż+Θ
```
[Try it online!](https://tio.run/##yygtzv7/P/joHu1zM/7//x9tqGNooGNiqmNoZKBjBGQamRqBaRAfJAxkxQIA "Husk – Try It Online")
## Explanation
```
Sz+Θ
S     take the input
   Θ  and itself with 0 prepended
 ż+   and zip with addition, preserving elements
```
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 4 bytes
```
LcŻ$
```
[Try it online!](https://tio.run/##y0rNyan8/98n@ehulf@PGncoHG5/uLNFRcHy8IRDCxVOLAcK/QcA "Jelly – Try It Online")
Same length as [Unrelated String’s answer](https://codegolf.stackexchange.com/a/216488/66833) but uses a different method
[Answer]
# [Red](http://www.red-lang.org), 37 bytes
```
func[c][alter c 0 c + reverse copy c]
```
[Try it online!](https://tio.run/##TY3BCgIxDETv@xXjyYMI3eJePPgRXkMOJZuiqNsl1hW/vrYi6ECYlzBkTMdy1JG4i3uU@JiEhClcsxoErs4GpovaXSFpfkG4xGQa5ARLT1CHKur56/iR/@PeYTeg9w6@oh/8x9vezq4lmTDbecqg9ne9PSDiFi6KRSUnW7U6Bpc3 "Red – Try It Online")
Takes the input as a `vector!`
Instead of inserting/appending a zero to the list, I use `alter` (for -1 byte) - it appends the value to the list if not present and removes it if present - the zero is guaranteed to not be in the list.
[Answer]
# Scala 3, 26 bytes
```
x=>(0::x)zip(x:+0)map(_+_)
```
[Try it online!](https://scastie.scala-lang.org/lCHlOBQnTNKpRhp2ql8iLA)
Pretty much a literal translation of the original APL expression, albeit more verbose.
[Answer]
# Kakoune, 20 bytes
```
A,0<esc>x_S,
y<a-)>a+<c-r>"<esc>|bc
```
[![asciicast](https://asciinema.org/a/qFyBsM4FiimUbwvqpGpOnktk7.svg)](https://asciinema.org/a/qFyBsM4FiimUbwvqpGpOnktk7)
Takes the input in the default buffer, as a sequence of comma-separated list of numbers. Has a trailing newline at the end.
Explanation:
```
A  <esc>                       *A*ppend the following to the end of the line:
 ,0                            Literal ,0
        x                      Select the whole line, including the newline
         _                     Trim the selection, removing the newline
          S,<ret>              Split the selection on every comma
y                              Copy the contents of every selection to the default "-register
 <a-)>                         Rotate the contents of the selections rightwards
      a       <esc>            Append to every selection:
       +                       Literal +
        <c-r>"                 The contents of the "-register
                   |bc<ret>    Pipe every selection into bc, evaluating it
```
[Answer]
## Wolfram Language (Mathematica), 25 bytes (or 14, if phrased as suggested by @att in the comments below)
```
Prepend[#,0]+Append[#,0]&
```
And below is a more "Mathematica-like" solution, in that it uses a mathematical primitive most other languages lack. It requires more bytes than the solution above (which is how most Mathematica programmers would probably solve this in the real world anyway).
```
(n=Length[#];Table[Binomial[n,k],{k,0,n}])&
```
[Answer]
# [C# (.NET Core)](https://www.microsoft.com/net/core/platform), 98 bytes
```
IEnumerable<long> p(IEnumerable<long> l)=>l.Concat(new[]{0L}).Zip(new[]{0L}.Concat(l),(a,b)=>a+b);
```
[Try it online!](https://tio.run/##ZVLfa9swEH62/wrRJ5uqQdLpx4lsfRljDDoY7GGw0gfF9TKBI2e20zFC/vbsnC5t7IKNdHe6u@/u@6r@pmq7@rjrY1qzb3/7od4s80tr8aFtmroaYpv6xac61V2sZi/uYvq9zPPtbtXEivVDGOiomtD37GvXrruwyfd5Ng0/tfGRfQkxFf3QUa37Bxa6dV/m2T4/fv6Ydpu6C6umfte0aX3LtsVbX1O@v20IXqrCUKT6z/3DXtwdysWPuH01z/Gm5EXgK0oJ16tyecyynzR3qH4VT6FjkcXEzlmSG8GlUoZLb4XgCgSMh5ToLEUMeuHI4T2i1nQxYNGhpSxlhNEAY1QK5ZRyKJ3g4MDQjzj6lQTvrZGSDDAarTASxz4eHGpjjT11o1KovHFGKsG1V9TDW2/IwT1qB86Dl3JEisKAUYgIjoIgtDCeQCAoqqOdVF7RNBpoGG4dKKe1FVaNYBCd9iiNstqeMKPQoAwAoXjGOgKkK5xASXonBSXrsZV6G5/lz8rPms@gzYDPxprOPN3HdFeTNU4WPF39JScXXF1Q@MrrC9Uv5J/V8F8cz0o5iWak5FCSkEnJWZaR/vq2qRffuzjURby@YlflkgKHnL7D8R8 "C# (.NET Core) – Try It Online")
[Answer]
# [SNOBOL4 (CSNOBOL4)](http://www.snobol4.org/csnobol4/), 58 bytes
```
N	J =INPUT	:F(O)
	OUTPUT =I + J
	I =J	:(N)
O	OUTPUT =I
END
```
[Try it online!](https://tio.run/##K87LT8rPMfn/34/TS8HW0y8gNITTyk3DX5OL0z80BMgDCipoK3hxcXoq2HpxWmn4aXL5I6S4XP1c/v835DIGQkMA "SNOBOL4 (CSNOBOL4) – Try It Online")
I/O as numbers separated by newlines.
```
N	J =INPUT	:F(O)	;* Read input. If none exists, goto O
	OUTPUT =I + J		;* Print I (initially 0) + J
	I =J	:(N)		;* Set I to J and goto N
O	OUTPUT =I		;* print I (always 1), and terminate the program
END
```
[Answer]
# [MathGolf](https://github.com/maxbergmark/mathgolf/blob/master/math_golf.txt), 6 [bytes](https://github.com/maxbergmark/mathgolf/blob/master/code_page.py)
```
ê0▌_x+
```
Port of [my 4-bytes 05AB1E program](https://codegolf.stackexchange.com/a/216486/52210).
[Try it online.](https://tio.run/##ZVK5VUQxDMxpBQe6j2p4JEAAj4SAIogpgjbohEY@kheWtQls67I00ujp9uXh/vnx7jg@P@Dr/e3m9fo48ApHH5o3whAdSDCoRFKab@tthhmjbaBS06BiGLgfxHArj0aClyEzQqQEZQsP004HKsztRSAn8kCHwc5aJ6LthJxpilgKq4SBYnSdZA9RU5vVKlVQquuEllQ10lLLMDLE2ZMTsZEGKCtFBHs5GQQ0C0QwVR5xpKTqRriaGeZMLmJg1GAiXDJQycQm5gBhUuZCccLaAEvkCQorDqE@S5ei//7t/5Z@K75B24Bvba09r/NYZ7WMcRnwOvpLTi64uqDwj9cz1Wfyf7fhZzlOmzKXpin5Bg)
**Explanation:**
```
ê       # Push all inputs as integer array
 0▌     # Prepend a 0
   _    # Duplicate the list
    x   # Reverse this copy
     +  # Add the values at the same positions in the two lists together
        # (after which the entire stack joined together is output implicitly as result)
```
[Answer]
# [Charcoal](https://github.com/somebody1234/Charcoal), 12 bytes
```
ＩＥ⊞Ｏθ⁰⁺ι§θ⊖κ
```
[Try it online!](https://tio.run/##S85ILErOT8z5/z@gKDOvRMM5sbhEwzexQCOgtDjDvyC1KLEkv0ijUEfBQFNHISCntFgjU0fBscQzLyW1AiTskppclJqbmleSmqKRrQkG1v//R0cb6iiY6CiYgUnD2Nj/umU5AA "Charcoal – Try It Online") Link is to verbose version of code. Explanation:
```
    θ           Input array
  ⊞Ｏ ⁰          Append literal `0`
 Ｅ              Map over elements
       ι        Current element
      ⁺         Plus
        §θ⊖κ    Previous element (cyclic)
Ｉ               Cast to string
                Implicitly print
```
Alternative approach, relies on symmetry:
```
ＩＥ⮌⊞Ｏθ⁰⁺ι§θκ
```
[Try it online!](https://tio.run/##S85ILErOT8z5/z@gKDOvRMM5sbhEwzexQCMotSy1qDhVI6C0OMO/ILUosSS/SKNQR8FAU1NHISCntFgjU0fBscQzLyW1AiSerQkC1v//R0cb6iiY6CiYgUnD2Nj/umU5AA "Charcoal – Try It Online") Link is to verbose version of code. Explanation:
```
     θ          Input array
   ⊞Ｏ ⁰         Append literal `0`
  ⮌             Reverse
 Ｅ              Map over elements
        ι       Current element
       ⁺        Plus
         §θκ    Element from unreversed list
Ｉ               Cast to string
                Implicitly print
```
In both of the above you can replace `⊞Ｏθ⁰` with `θ` and prefix `⊞θ⁰` to the start for the same effect.
]