[Question]
  [
Given the diagonals of a matrix, reconstruct the original matrix.  
The diagonals parallel to the major diagonal (the main diagonals) will be given.  
[![matrix image](https://i.stack.imgur.com/iwfTs.png)](https://i.stack.imgur.com/iwfTs.png)
Diagonals: `[[5], [4, 10], [3, 9, 15], [2, 8, 14, 20], [1, 7, 13, 19, 25], [6, 12, 18, 24], [11, 17, 23], [16, 22], [21]]`
## Rules
* The matrix will be non-empty and will consist of positive integers
* You get to choose how the input diagonals will be given:
	1. starting with the main diagonal and then alternating between the outer diagonals (moving outwards from the main diagonal)
	2. from the top-right diagonal to the bottom-left diagonal
	3. from the bottom-left diagonal to the top-right diagonal
* The end matrix will always be a square
* The order of the numbers in the diagonals should be from top-left
to bottom-right
* Input and output matrix can be flattened
* This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"), so the shortest answer wins
# Test cases
```
[In]: [[5]]
[Out]: [[5]]
[In]: [[1, 69], [0], [13]]
[Out]: [[1, 0], [13, 69]]
[In]: [[25], [0, 1], [6, 23, 10], [420, 9], [67]]
[Out]: [[6, 0, 25], [420, 23, 1], [67, 9, 10]]
```
  
[Answer]
# [Vyxal](https://github.com/Vyxal/Vyxal), ~~14~~ 12 bytes
```
Ṗ'L√ẇÞDf?⁼;h
```
[Try it Online!](https://vyxal.pythonanywhere.com/#WyIiLCIiLCLhuZYnTOKImuG6h8OeRGY/4oG8O2giLCIiLCIxLDY5LDAsMTMiXQ==)
Math? Sensible methods of putting things into arrays? Programs that finish in reasonable time? Couldn't be me.
Times out for anything bigger than a 2x2 matrix.
Takes input as a flattened list and outputs a flattened list.
## Explained (old)
```
f₌ṖL√vẇ'ÞD?⁼;h
f₌ṖL√           # Push all permutations of the flattened input, as well as the square root of the length of the flattened input  
     vẇ         # Split each permutation into chunks of that length
       'ÞD?⁼;   # Keep those only where the diagonals equal the input (this basically means try each and every single possible matrix from the input until one is found with the same diagonals)
              h # Get the first (and only) item
```
[Answer]
# [Python](https://www.python.org), 60 bytes (@Mukundan314)
```
f=lambda x:x and zip(map(list.pop,x[::-2][::-1]),*f(x[:-1]))
```
[Attempt This Online!](https://ato.pxeger.com/run?1=NVBBasMwELz7FXtcGVmJA4HWRC8xpmyruBVY2sVRwO5Xesmlvfc5_U0lk1x2h9lhZtivH1nTB8fb7fuaxubp7zTaicKrI1i6BSg6-PSCgQQnf0lGWPTSd11zGMpsB6XrETNToLp7_PogPCeI1yAr0AWiVHfqjWWtCGymzJzdOWzLx4R73e41HvVRqcplRZ8lztM7ko67XXOosWlVXUdlEpcuqGDkGSL4uLm99N3zMFRst-OIJcq481kKQKeyrcwliLTTrJGtJWVomvBR_PGEfw)
## [Python](https://www.python.org), 62 bytes
```
f=lambda x:x and[*zip(map(list.pop,x[::-2][::-1]),*f(x[:-1]))]
```
[Attempt This Online!](https://ato.pxeger.com/run?1=NZBBasMwEEX3PoWWIyErcSDQGpSLGFGmVZwILM3gKGD3Kt1k0256ot6mUppuZobP5_3PfHzxms-UbrfPax7bp5_DaCeMrx7F0i8Ckx_Ue2CIyDCFSzZMrJeh79udq7NzUqsRilJP6R6U7xCZ5izSNfIq8CISNw_pjXhtUNgimbnwKd5XSBm2uttq2Ou9lI0vjqFYfMAToE6bTbtT0HZSqSRNploGpBhpFkmEdKe9DP2zcw3ZEWqK8ccj1wN8AfJcI1B7TRrIWpQGpwmk_Kv8_4Bf)
Uses input format 1 (alternating upper and lower diagonals). Destroys the input.
[Answer]
# [J](https://www.jsoftware.com), 21 20 bytes
```
/:&;</.@i.@(,-)@%:@#
```
[Attempt This Online!](https://ato.pxeger.com/run?1=TU9LCsIwEN33FE9FayGtSWtTGxUKgiAIgtuQlVjUhW4qeBc3deENvIzn8AKOiUoXycy83yTX26F-dvOWEka2VO77XjvyS0wVfDBwKDphhNl6Ob-fqzIcPQaqN54MomIfFX0WBkVXFR1HPV-Bt93sTijB0l_HISBziOQHxKnDECcQHMOYI4fMvO1lX9F6vTgaBa1TYzy9Olf_4c8IRoGGQfPPJZKmkLgvakUNV5xaC4P4VMloPfVWTE9gsIkya4aRiAhntBprcToyWLtxX69rV98)
Takes in flat, outputs flat.
* `%:@#` Square root of list length, to get matrix side length. Call it `n`.
* `(,-)` Create list `n -n`
* `i.` Assuming `n` is 5, eg, this will create the matrix:
```
4  3  2  1  0
9  8  7  6  5
14 13 12 11 10
19 18 17 16 15
24 23 22 21 20
```
* `</.@` Create the boxed diagonals of this matrix:
```
┌─┬───┬──────┬─────────┬────────────┬──────────┬────────┬─────┬──┐
│4│3 9│2 8 14│1 7 13 19│0 6 12 18 24│5 11 17 23│10 16 22│15 21│20│
└─┴───┴──────┴─────────┴────────────┴──────────┴────────┴─────┴──┘
```
* `/:&;` Unbox that and use it to sort the original input, ie, whatever sort would put this into order, apply it to the original input. This does exactly what we want.
[Answer]
# [Pip](https://github.com/dloscutoff/pip) `-x`, 22 bytes
```
Fi,YMX#*aFki+R,yPPOa@k
```
Inputs a nested list of diagonals, starting from the top right, as a command-line argument; outputs a flattened matrix in row-major order to stdout, one number per line. [Try It Online!](https://dso.surge.sh/#@WyJwaXAiLCIiLCJGaSxZTVgjKmFGa2krUix5UFBPYUBrIiwiIiwiIiwiLXggXCJbWzVdOyBbNDsgMTBdOyBbMzsgOTsgMTVdOyBbMjsgODsgMTQ7IDIwXTsgWzE7IDc7IDEzOyAxOTsgMjVdOyBbNjsgMTI7IDE4OyAyNF07IFsxMTsgMTc7IDIzXTsgWzE2OyAyMl07IFsyMV1dXCIiXQ==)
### Explanation
For an \$N\$ by \$N\$ matrix, the top row can be found by taking the first number from each of the first \$N\$ diagonals and reversing them. If we remove these numbers from their respective diagonals, the next row is the reverse of the first remaining number in the first \$N\$ non-empty diagonals, and so on.
```
Fi,YMX#*aFki+R,yPPOa@k
        a               Command-line argument, evaluated (-x flag)
      #*                Length of each sublist
    MX                  Maximum (this gives the size of the desired matrix)
   Y                    Store in y
Fi,                     For i in range(y):
         Fk               For k in
              ,y          range(y)
             R            reversed
           i+             with i added to each element:
                   a@k      Sublist at that index
                 PO         Pop its first element
                P           Print the popped element
```
[Answer]
# JavaScript (ES6), 65 bytes
Expects the diagonals from top-right to bottom-left.
```
a=>a[w=a.length>>1].map((_,y,A)=>A.map((_,x)=>a[w+y-x][x<y?x:y]))
```
[Try it online!](https://tio.run/##bY/BDoIwEETvfkWPNBZCFwQxguE7msY0CKhBIEIUvh6XVU5ym9l529nezct02fPW9nbdXPKpiCcTJ0a9Y@NUeV321ySR2nmY1rLOYhQpj5N0sQMndDvag1bDcTwNh1FzPmVN3TVV7lRNaRWWUjstmPIFk@4sPMEi1DQEwfaoMQPKpGAhekQkMkBMgAY5iSD4BCElEQOPHOYA9JjU2L75b1@bLnVBRMJbhb4HuFj3OwS85Rc@4Jh2g3DenT4 "JavaScript (Node.js) – Try It Online")
Also **65 bytes**:
```
a=>[...a[w=a.length>>1]].map((_,y,A)=>A.map(_=>a[w+y--].shift()))
```
[Try it online!](https://tio.run/##bY/NDsIgEITvPgVHiJSUba16gKTPQUhDtD@a2hrbaHx6XFd70tvM7LfMcg73MB1up@ucDOOxjo2JwVinlAruYYLq66GdO2u19@oSrpxX8ilLYWxJtjIWufUzSbyaulMzcyFEPIzDNPa16seWN9y5jZfM5ZLp9C0yyfaoKQTJdqhxBjTTkm3RI6KRAWIKNMhpBCEnCCmNGGTkcA5Aj@GRQqx@2/@lS12xJ5H9hT4HpFj3PQSy5Rc5YEy7xfa9G18 "JavaScript (Node.js) – Try It Online")
---
# Flatten format, 89 bytes
This version expects a flatten array of the diagonals from top-right to bottom-left and returns another flatten array.
The only benefit is that there's only one `map()`. But the math is much more verbose. So yeah ... that's a bit silly. :-) There may be a better/shorter formula, though.
```
a=>a.map((_,x)=>a[y=x/w|0,x%=w,n=y+w+~x,(q=n>w&&n-w)*~q-n*~n/2+(x<y?x:y)],w=a.length**.5)
```
[Try it online!](https://tio.run/##bY7LCsIwFET3fkU2StLeVhO1PjD6ISIStL6oqS9MCtJfrxN0JW7C3DkzTE7mae6b2/HySGy5zZudboyem/RsLpyvyQscy0r7rnv1yLe1I6ur2MW1J37Vdu46HZs4EdXXxEa17aqY@1m18NNKrMhpkxa53T8OUZQORbMp7b0s8rQo93zHl0NiA2KyR6xPbAIFQxEbQ8FX8CWxEV5gCa7AM0hkJEIqlJGQiKgQAVNgSq6EaP1u/fE@A1lY7v/BYe4b@Q7gGoRvoZGN0Gje "JavaScript (Node.js) – Try It Online")
Given an input array of length \$N\$, we define for each index \$0\le i \lt N\$:
$$x=i\bmod w\\
y=\lfloor i/w \rfloor\\
n=y+w-x-1\\
q=\max(n-w,0)$$
where \$w\$ is the width of the matrix, i.e. \$\sqrt{N}\$.
The output value at this position is the value stored in the input array at the following index:
$$\frac{n\times(n+1)}{2}-q\times(q+1)+\min(x,y)$$
[Answer]
# [Ruby](https://www.ruby-lang.org/), 62 bytes
```
f=->d{(w=0..l=d.size/2).map{|r|w.map{|c|d[l+r-c][[r,c].min]}}}
```
[Try it online!](https://tio.run/##VYzRCoIwFIbvfYpBN0pzbSuNAnuFHuBwLmwmCDNkJVLqs6@5QeTVzv7/@37T397W1kV6qcZ4KDhjuqjYs/ncdzJhbdmNk5mGcKipAr01qUIAQxWytnngPM@2IzVTpdYxQIaYRBu49i88E/@Nol/tAo4UBCX5CSkBsV/TruAh98S/CiCzpeKUiOXNKZGOEp4/SBf7xfy4XnSYq4LqKS8F0il@ACP7BQ "Ruby – Try It Online")
Takes input as top-right to bottom-left.
Maps 2d indexes to input, for example a 4X4 matrix:
```
3,0  2,0  1,0  0,0
4,0  3,1  2,1  1,1
5,0. 4,1  3,2  2,2
6,0  5,1  4,2  3,3
```
[Answer]
# [APL(Dyalog Unicode)](https://dyalog.com), ~~21~~ 22 bytes [SBCS](https://github.com/abrudz/SBCS)
```
⊖w↑i⊖↑⌽⍨≢↑⍥-i←⍳w←≢∘⍉∘↑
```
[Try it on APLgolf!](https://razetime.github.io/APLgolf/?h=e9Q31dP/UdsEAwA&c=e9Q1rfxR28TMR13TgNSjnr2Pelc86lwEYvcu1c181DbhUe/mchAFFOyY8ai3E0S2TQQA&f=NY47EsQwCEP7nOKVSWcJx44vlPsfYcE7adBnkODltC5ODexCoYkj6UBGD@7lM1Gghe@U5kEdt@TBQmV2VPq@jvebip0dK6FtZ8zadGPtE45/qFFfZPcP&i=AwA&r=tryapl&l=apl-dyalog&m=train&n=f)
`∘↑` mix the lists into a matrix, padding on the right with 0s, then…
 `∘⍉` transpose, then…
  `≢` tally the number of rows (this gives the size of the matrix)
`w←` store as `w` (for **w**idth)
`⍳` generate indices from 0 to that − 1
`i←` store as `i` (for **i**ndices)
`≢`…`⍥-` negate the argument length and that, then:
 `↑` take arg-length elements from (because negative; the rear) of the indices, padding with 0s
…`⌽⍨` use those numbers to rotate left (because negative; right) the rows of:
 `↑` the original argument lists mixed into a matrix, padded on the right with 0s
`i⊖` rotate the columns up by the amounts `i`
`w↑` take the first `w` rows of that
`⊖` flip upside-down
[Answer]
# [MathGolf](https://github.com/maxbergmark/mathgolf/blob/master/math_golf.txt), 21 [bytes](https://github.com/maxbergmark/mathgolf/blob/master/code_page.py)
```
h½)r■_@mÅε-_╙+§\mÄ╓m§
```
Input expected as option 2: top-right to bottom-left 2D list.  
Output as a flattened list.
[Try it online.](https://tio.run/##JY29DcIwEIV7NkE8pNzZceKOPYwV0UAKLCTECDBBFCQ6ukxASeP0DJFFjC9p7u9971043NrT5XxMqY3f9XV6vptdGB@/z7aZ@tcmDvsw3qe@C3FIybnS@5VzhYcjGCtNzRcu81yAcjVgBRJEcwFhTDUzguhFUbAg2Rk1SIOXxAqUrRZzmgExqAZr0QhU5WAZ8wMWK3n/Bw)
**Explanation:**
```
h          # Push the input-length (without popping)
 ½         # Integer-divide it by 2
  )        # Increase it by 1
   r       # Pop and push a list in the range [0,length(input)//2+1)
    ■      # Get the cartesian product of this list, creating pairs
_          # Duplicate this list of pairs
 @         # Triple swap input,pairs,pairs -> pairs,input,pairs
  m        # Map over each pair,
   Å       # using 2 characters as inner code-block:
    ε      #  Reduce the pair by:
     -     #   Subtracting
      _    # Duplicate this list
       ╙   # Pop and push the maximum (which is length(input)//2+1)
        +  # Add it to each integer in the list
         § # Get the inner lists of the input at those indices
 \         # Swap so the other pairs-list is at the top again
  m        # Map over each pair,
   Ä       # using 1 character as inner code-block:
    ╓      #  Pop and push the minimum of the pair
     m     # Map over both lists:
      §    #  Index these minima into the inner lists
           # (after which the entire stack is output implicitly as result)
```
[Answer]
# [Python](https://www.python.org), ~~84~~ 79 bytes
-1 byte thanks to Kevin Cruijsen  
-5 bytes thanks to Mukundan314 and 07.100.97.109
```
lambda x:(z:=len(x)//2+1)and[x[z+c%z+~c//z][min(c%z,c//z)]for c in range(z*z)]
```
[Attempt This Online!](https://ato.pxeger.com/run?1=m72soLIkIz9vwdI0BVuFmKWlJWm6Fjf9chJzk1ISFSqsNKqsbHNS8zQqNPX1jbQNNRPzUqIroqu0k1WrtOuS9fWrYqNzM_M0gFwdEE8zNi2_SCFZITNPoSgxLz1Vo0oLKAY1NbGgKDOvRCNNIzraNDZWU5MLma8TbaKjYByroxBthCZnZAoSNdBRMATRZjoKRsZAtgGIY2IEFLYEC5uDdEEsWrAAQgMA)
Ported from Arnauld's JS answer
[Answer]
# [Jelly](https://github.com/DennisMitchell/jellylanguage), ~~9~~ 8 bytes
```
ṙLHĊƊṚŒḌ
```
[Attempt This Online!](https://ato.pxeger.com/run?1=m700KzUnp3LBgqWlJWm6Fpt8PI50cT3cOfNw-8Ods45OerijZ0lxUnIxVPpmYbRSdLRprI5CtImOgqEBiGGso2AJZIMFjXQULIBsoJwRWM5QR8EcyAcqMQSqMQKrMQNygOoMgQqNTMCKgKoMgcqMjME8oLyREdgww9hYpViozQA)
How?
```
ṙLHĊƊṚŒḌ : Main Link
 L       : length; used to count the number of elements
  H      : Halve; divides by 2 
   Ċ     : Rounds up (ceil)
    Ɗ    : Last three links as a monad
ṙ        : Rotate x y times (x is implied input)
     Ṛ   : Reverse element
      ŒḌ : Reconstruct matrix from its diagonals
```
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E/wiki/Commands), ~~20~~ 18 [bytes](https://github.com/Adriandmen/05AB1E/wiki/Codepage)
```
g;ÝDδ-Z+èεNUεNX‚ßè
```
-2 bytes porting [*@Arnauld*'s JavaScript answer](https://codegolf.stackexchange.com/a/252086/52210) (somewhat). I have the feeling the `εNUεNX‚ßè` could perhaps be golfed some more.
Input expected as option 2: top-right to bottom-left 2D list.  
Output as a matrix.
[Try it online](https://tio.run/##yy9OTMpM/f8/3frwXJdzW3SjtA@vOLfVLxSIIx41zDo8//CK//@jo01jdRSiTXQUDA1ADGMdBUsgGyxopKNgAWQD5YzAcoY6CuZAPlCJIVCNEViNGZADVGcIVGhkAlYEVGUIVGZkDOYB5Y2MwIYZxsYCAA) or [verify all test cases](https://tio.run/##NU07CsJAEO09RUjrEzKbzcZoYZPGRitBXLZQELFRwUSwCHgOQWxzAPUAbp9DeJF1x2AxnzfvM/vjcrVdu1M43h3KYhCEOKMTTsvij3K3Gdpb3jx6i66tm@dk5mv@uVzt3dauqvB@jZzWOjEGgdaRgSaojEfcnkTiQQTyXUHEINZIEYFFKm1FrJEtFSMDMRbogyREm5mCvDfDL06BBKgPIZkjUOqTefUfBFvJGPMF).
**Original 20 [bytes](https://github.com/Adriandmen/05AB1E/wiki/Codepage) answer:**
```
g>;©FD®£€нR,¦ε®N>›i¦
```
Input expected as option 2: top-right to bottom-left 2D list.  
Outputs each inner row-list on separated newlines to STDOUT.
[Try it online](https://tio.run/##yy9OTMpM/f8/3frwukMr3VwOrTu0@FHTmgt7g3QOLTu39dA6P7tHDbsyDy37/z862jRWRyHaREfB0ADEMNZRsASywYJGOgoWQDZQzggsZ6ijYA7kA5UYAtUYgdWYATlAdYZAhUYmYEVAVYZAZUbGYB5Q3sgIbJhhbCwA) or [verify all test cases](https://tio.run/##NY09CsJAEIV7TxFSvyKz2fwpaBMEGwXbZQsFERsVTASLgHgVISBIOi0Em7UXz5CLrLsuNjPzZr73ZrObzVcLvfdH621ZdD0fB3T8SVn8Va6XvVejLsNcNercnq6f5xSqft9UM@63x8dK1bqqKnUfaCFEJCU8IQIJQYgz20K3YpERAcjUGCwEWYazABaKEwdZhrtTiAxkNUMK4mAuMwEZb4ZfXAxioBSM2xuBEpNsR/OBWStJKb8).
**Explanation:**
```
g               # Get the length of the (implicit) input 2D list
 ;              # Halve it
  Ý             # Push a list in the range [0, length(input)//2]
   Dδ-          # Pop and push its subtraction table:
   D            #  Duplicate the list
    δ           #  Apply double-vectorized over the two lists:
     -          #   Subtract
      Z         # Push the flattened maximum (without popping),
                # which is the length(input)//2
       +        # Add it to each integer
        è       # Index each inner-most integer into the (implicit) input
ε               # Map over each inner list of lists:
 NU             #  Store the map-index in variable `X`
 ε              #  Map over each inner list:
  NX‚ß          #   Push the minimum of the inner and outer indices:
  N             #    Push the inner map-index
   X            #    Push the outer map-index from variable `X`
    ‚           #    Pair them together
     ß          #    Pop and push the minimum
      è         #   Index that minimum into the list
                # (after which the resulting matrix is output implicitly)
```
[Extracted from this 05AB1E answer of mine](https://codegolf.stackexchange.com/a/241931/52210), where I've used 45 degree matrix rotations for a word-search solver:
```
g;              # Same as above
  î             # Ceil it
   ©            # Store this matrix-size in variable `®` (without popping)
    F           # Pop and loop this many times:
     D          #  Duplicate the current 2D list:
      ®£        #  Only keep the first `®` amount of inner lists:
        €н      #  Get the first item from each
          R     #  Reverse it
           ,    #  Pop and print it with trailing newline
      ¦         #  Remove the first inner list
       ε        #  Map over each remaining lists:
            i   #   If
        ®       #   dimension `®`
           ›    #   is larger than
         N>     #   the 1-based map-index:
             ¦  #    Remove the first item from this list
```
[Answer]
# [PARI/GP](https://pari.math.u-bordeaux.fr), 43 bytes
```
a->matrix(w=#a\2+1,,i,j,a[w+i-j][min(i,j)])
```
[Attempt This Online!](https://ato.pxeger.com/run?1=NY9BCsIwEEWvMuimpVMw01p1oReJQbKpRFRCqahncVMQ8UziZfyd2tX8_-flJ3m8o2_Cbh-7Z03r16Wt8-Un8_nm5Nsm3JLreuq3khnmwAf29pqF_ODsKZwTBKlL_0e-PsbjPfGUbyg24dxCTnozoTrxacpkrZ07jJLJzHpRMK2gNRSmJTR2ojvDtIAHYsCIMhUMOANQSoVAGWBSqMNeRMuM6weu0zEWVisVxZAOnTM0_LulGB9WCmKFq4Vz4xe7bpg_)
Takes input from top-right to bottom-left.
[Answer]
# Haskell + [hgl](https://gitlab.com/wheatwizard/haskell-golfing-library), 25 bytes
```
lH(F~<zdm<<lpW[]<lg)<mm p
```
[Attempt This Online!](https://ato.pxeger.com/run?1=m708I7E4OzUnZ2W0km6Ec0CAUuxN1czcgvyiEoXC0sSczLTM1BSFgKLUnNKUVC6oRABXmm3M0tKSNF2LnTkeGm51NlUpuTY2OQXh0bE2OemaNrm5CgUQ-ZsGuYmZebYp-VwKCrnxCgVFCioKaQrRSvZKOkoREUo6CkqGRsYgSlUVRDooxUL0LVgAoQE)
## Explanation
To build the matrix we use a fold, each step adding a new diagonal. So the bulk of this answer is the function that takes a partial matrix and adds a new diagonal.
The way this process works is that we want to zip the new diagonal with the matrix. If the diagonal is longer than the matrix so far (length of the matrix is the number of rows), then we want to start the zip with the two aligned at the front.
```
1 ####      1####
2  ###       2###
3   ##  -->   3##
4    #         4#
5               5
```
If the diagonal is shorter we want to align it at the bottom:
```
  #####     #####
  #####     #####
1  #### --> 1####
2   ###      2###
3    ##       3##
```
To do this we pad the diagonal out to the length of the list with empty values. (`lpW[]<lg`) If it's longer this does nothing, but if it's shorter it aligns the two at the bottom.
Then we zip the two with `zdm`. This is the "monoidal" zip, so it pads the shorter value to the length of the longer and combines with the monoid operation.
The one hitch is that for this all to work we need to convert the integers in the diagonals to lists, that way we can have empty values in the padding.
## Reflection
This is a very elegant solution, but it does suggest improvements.
* It hurts me to use `lg`. Because there's nothing to bind the type `l` won't work. `lpW^.lg` should probably be builtin, padding one list to the length of another seems like a useful operation. This would save 3 bytes here.
* `fb F` seems like a useful combinator. However it would need to be a 1 byte operator to save anything in this particular scenario.
[Answer]
# [Curry (PAKCS)](https://www.informatik.uni-kiel.de/%7Epakcs/), 73 bytes
```
foldl(!)[]
[]#[]=[]
(a:b)#(c:d)=(c:a):b#d
a!b=(a++[[]])#b
(a++b)!c=a++b#c
```
[Try it online!](https://tio.run/##HYxLCsMwDET3OYWCNzZxoXbSX8AnEVrYDoHSpC0pXfT07sQb6Y3mofzdtt/hHR/5U8oc5tcyLbo1LA2LYgkAHcdklM7jZAJmNGNSUxPbFHTsOmYRo1KzczJtDvtWuazx/qRAMzGfxBIPltxxh97SDVyP3tIVjM7Xzlm6IENxcHx1zgjwHEQ/VAmWg@b7mtB7X585kfIH "Curry (PAKCS) – Try It Online")
A port of [@Wheat Wizard's Haskell + hgl answer](https://codegolf.stackexchange.com/a/256312/9288).
[Answer]
# [Charcoal](https://github.com/somebody1234/Charcoal), 18 bytes
```
Ｉ⮌Ｅ⊘⊕ＬθＥ⊘⊕Ｌθ⊟§θ⁺ιλ
```
[Try it online!](https://tio.run/##jYpLCsIwEECvkuUUIjhp6wdX4saCQnEbsghtsIWYtmks3j5OgwdwYGDee9N02jeDtjHWvncBLnoO8DCL8bOBux7hqu1iWqhc483LuED3zbhn6GDKsoyzf37qYYRzqFxrPjAR2vcMPWc2@80pRimlQMWZxB1nQqQLOcM9Ub4SaRS0BxJFypxRxJz2SK5cHT1Qx4J4uzJFapgaSUyyVErFzWK/ "Charcoal – Try It Online") Link is to verbose version of code. Takes input from bottom left to top right. Explanation:
```
      θ             Input array
     Ｌ              Length
    ⊕               Incremented
   ⊘                Halved
  Ｅ                 Map over implicit range
           θ        Input array
          Ｌ         Length
         ⊕          Incremented
        ⊘           Halved
       Ｅ            Map over implicit range
              θ     Input array
             §      Indexed by
                ι   Outer index
               ⁺    Plus
                 λ  Inner index
            ⊟       Pop from list
 ⮌                  Reversed
Ｉ                   Cast to string
                    Implicitly print
```
[Answer]
# [Wolfram Language (Mathematica)](https://www.wolfram.com/wolframscript/), 77 bytes
```
(n=⌊Length@#/2⌋;Total@MapThread[DiagonalMatrix[#1,#2]&,{#,Range[-n,n]}])&
```
Input from the bottom-left diagonal to the top-right diagonal
[Try it online!](https://tio.run/##FYjPCoIwGMBfZTCQgi/SVUaEsEPHhAhvssNHTR3oZ4wdgrEXKJ/SF1l5@v0Z0HV6QGceGJsirqiYp89VU@s6ybdinr7nanTYyxJfVWc1PuuLwXYk7Et01rxrngEXKgHP4Y7U6npDQCqodRJv1pCTjfQ@PwZgfi9SYKfFcmBiByxLl/jPbKE4hBB/ "Wolfram Language (Mathematica) – Try It Online")
]