[Question]
  [
I once had a beautiful rectangular array. It was very symmetrical, but unfortunately it has fallen apart and now I only have the top left corner. Your task will be to rebuild the original array.
Your program will receive a 2 dimensional array of integers. For ease of parsing, you may assume they are all between 1 and 9. Your task is to reverse the array's columns, its rows, and both, stitch together the resulting corners, and return the resulting array.
You can assume the array dimensions will be at least 1x1.
Test cases:
```
Input:
1 2 3
4 5 6
Output:
1 2 3 3 2 1
4 5 6 6 5 4
4 5 6 6 5 4
1 2 3 3 2 1
```
---
```
Input:
1
Output:
1 1
1 1
```
---
```
Input:
9
9
9
Output:
9 9
9 9
9 9
9 9
9 9
9 9
```
This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"), fewest bytes wins!
  
[Answer]
# [Canvas](https://github.com/dzaima/Canvas), 1 [byte](https://github.com/dzaima/Canvas/blob/master/files/chartable.md)
```
╬
```
[Try it here!](https://dzaima.github.io/Canvas/?u=JXUyNTZD,i=JTVCJTI3MTIzJTI3JTJDJTI3NDU2JTI3JTJDJTI3Nzg5JTI3JTVE,v=1)
Outputs as a multiline string
[Answer]
## Haskell, ~~25~~ 24 bytes
```
r=(++)<*>reverse
r.map r
```
[Try it online!](https://tio.run/##y0gszk7Nyfn/v8hWQ1tb00bLrii1LLWoOJUrzbZILzexQKHof25iZp6CrUJKPpeCQkFRZl6JgopCmkJ0tKGOkY5xrE60iY6pjllsLLoshoglUC0Ex/4HAA "Haskell – Try It Online")
[Answer]
# Python 3, 38 bytes
```
lambda a:[b+b[::-1]for b in a+a[::-1]]
```
[Try it online!](https://tio.run/##LYwxDoMwDEVncgpvFOEOlLYSljiJ68ERREVqA4IsnD40oYP1/Z/037KH9@zb6PpX/OjXDgpKbGvLRNdG3LyChcmD1noSiWHcwgY9sCmYG7xhK8h3fOBTBDP7Z/fj54kRk1RpmmxZQaZY1smHS2pYUokuv1UVDw "Python 3 – Try It Online")
Takes a list of lists and returns a list of lists.
Explanation:
```
lambda a:                              # anonymous lambda function
                   for b in a+a[::-1]  # for each row in the array and the upside-down array
          b+b[::-1]                    # the row with its reverse appended
         [                           ] # return in a list
```
[Answer]
# [Husk](https://github.com/barbuz/Husk), ~~7~~ 6 bytes
Coincidentally, [Erik](https://codegolf.stackexchange.com/users/41024/erik-the-outgolfer) had posted the [exact same code in the Husk chatroom](https://chat.stackexchange.com/transcript/message/43218478#43218478) about a minute before I posted this. 
```
‼oTS+↔
```
[Try it online!](https://tio.run/##yygtzv7//1HDnvyQYO1HbVP@//8fHW2oY6RjHKsTbaJjqmMWGwsA "Husk – Try It Online")
Pervious version, [**7 bytes**](https://tio.run/##yygtzv7/PzdY@1HbFDDx////6GhDHSMd41idaBMdUx2z2FgA "Husk – Try It Online"):
```
mS+↔S+↔
```
[Answer]
## [Retina](https://github.com/m-ender/retina/wiki/The-Language), 13 bytes
```
\%`$
$^$`
Vs`
```
[Try it online!](https://tio.run/##K0otycxLNPz/P0Y1QYVLJU4lgSusOOH/f0MjYy4TUzMA "Retina – Try It Online")
### Explanation
```
\%`$
$^$`
```
On each line (`%`), match the end of the line (`$`), and insert the reverse (`$^`) of the entire line (`$``) and print the result with a trailing linefeed (`\`). This does the reflection along the vertical axis and prints the first half of the output.
```
Vs`
```
This just reverses the entire string, which is equivalent to a 180° degree rotation, or in our case (due to the horizontal symmetry) a reflection along the horizontal axis. This way this works is that `V`'s (reverse) default regex is `(?m:^.*$)`, which normally matches each line of the string. However, we activate the singleline option `s`, which makes `.` match linefeeds as well and therefore this default regex actually matches the entire string.
The result of this is printed automatically at the end of the program, giving us the second half of the output.
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), 2 bytes
```
∞∊
```
[Try it online!](https://tio.run/##MzBNTDJM/f//Uce8Rx1d//9HqxsaGavrqJuYmgFJcwtL9VgA "05AB1E – Try It Online")
---
```
   # Input:Array of String | ['12','34']
---#-----------------------+------------------------------------------
∞  # Mirror horizontally.  | [12,34]       -> [1221,3443]
 ∊ # Mirror vertically.    | [1221,3443]   -> [1221\n3443\n3443\n1221]
```
---
Credit for [Mr. Xcoder](https://codegolf.stackexchange.com/users/59487/mr-xcoder) pointing out that arrays of string may count as 2D arrays and [Pavel](https://codegolf.stackexchange.com/users/60042/pavel) for confirming it.
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 5 bytes
```
m€0m0
```
[Try it online!](https://tio.run/##y0rNyan8/z/3UdMag1yD////R0cb6igY6SgYx@ooRJvoKJjqKJjFxgIA "Jelly – Try It Online")
[Answer]
# [MATL](https://github.com/lmendo/MATL), 5 bytes
```
,tPv!
```
[Try it online!](https://tio.run/##y00syfn/X6ckoEzx//9oQwUjBWNrBRMFUwWzWAA "MATL – Try It Online")
Explanation:
```
(implicit input)
,               # do twice:
 t              # dup top of stack
 P              # flip vertically
 v              # vertically concatenate
 !              # transpose
(implicit output)
```
[Answer]
# [Octave](https://www.gnu.org/software/octave/), ~~33~~ 29 bytes
*Thanks to @Giuseppe for golfing four bytes!*
```
@(A)[B=[A;flip(A)] fliplr(B)]
```
[Try it online!](https://tio.run/##y08uSSxL/f/fQcNRM9rJNtrROi0nswDIiVUAMXKKNJw0Y/@nKdgqJOYVW3NxpWlEGyoYKRhbK5gomCqYxWpCRAytFYAEhGdprQBCsZr/AQ)
[Answer]
# [Ruby](https://www.ruby-lang.org/), 35 bytes
```
->a{r=->b{b+b.reverse}
r[a].map &r}
```
[Try it online!](https://tio.run/##KypNqvyfZvtf1y6xushW1y6pOkk7Sa8otSy1qDi1lqsoOjFWLzexQEGtqPZ/gUJadHS0oY6RjnGsTrSJjqmOWWxsLBdUGMG0BMpCcGzsfwA "Ruby – Try It Online")
A lambda accepting a 2D array and returning a 2D array. It's straightforward, but here's the ungolfed version anyway:
```
->a{
  r=->b{ b+b.reverse } # r is a lambda that returns the argument and its reverse
  r[a].map &r          # Add the array's reverse, then add each row's reverse
}
```
[Answer]
# [JavaScript (Node.js)](https://nodejs.org), ~~62~~ ~~55~~ ~~49~~ 46 bytes
```
A=>(j=x=>[...x,...[...x].reverse()])(A).map(j)
```
[Try it online!](https://tio.run/##HcZRCoMwDADQ6yQQAzrnj1TwHCUfpYtiqVbaId6@k/08XnCXKz5v57c50kfrYupsJgjmNpNl5pse/hHOemkuCigIM/LuTghYR5@OkqJyTCssYO2LOmqF7EBv6kUQ6w8 "JavaScript (Node.js) – Try It Online")
Because `Array.prototype.reverse()` reverses the array in place, I have to make a shallow copy somewhere first. `A=>(j=x=>[...x,...x.reverse()])(A).map(j)` does not work.
[Answer]
# [J](http://jsoftware.com/), 12 bytes
```
(,|.)@,.|."1
```
[Try it online!](https://tio.run/##y/qvpKeepmBrpaCuoKNgoGAFxLp6Cs5BPm7/NXRq9DQddPRq9JQM/2tyKXClJmfkK6QpGCkYqxiCSAUTBVMFM4iwuq4CEKrD1BgqGKoYYpUxBspY4pAxUbGzytQzNOL6DwA "J – Try It Online")
## Explanation
```
         |."1 - reverse each row
       ,.     - and stitch them to the input
 (   )@       - and 
  ,|.         - append the rows in reversed order        
```
[Answer]
# awk, 88 bytes
```
{s="";for(i=NF;i>0;i--)s=" "$i s" "$i;a[FNR]=s;print s}END{for(i=NR;i>0;i--)print a[i]}
```
[Answer]
# [Triangularity](https://github.com/Mr-Xcoder/Triangularity), 31 bytes
```
...)...
..IEM..
.DRs+}.
DRs+...
```
[Try it online!](https://tio.run/##KynKTMxLL81JLMosqfz/X09PTxOIufT0PF19QbRLULF2rR4XiAKK//8fHW2oo2Cko2Acq6MQbaKjYKqjYBYbCwA "Triangularity – Try It Online")
## Explanation
Removing the characters that make up for the padding, here is what the program does:
```
)IEMDRs+}DRs+ – Full program. Takes a matrix as a 2D list from STDIN.
)             – Push a 0 onto the stack.
 I            – Take the input at that index.
  E           – Evaluate it.
   M    }     – For each row...
    DR        – Duplicate and replace the second copy by its reverse.
      s+      – Swap and append.
         DR   – Duplicate the result and replace the second copy by its reverse.
           s+ – Swap and append.
```
[Answer]
# [R](https://www.r-project.org/), 57 bytes
```
function(m)rbind(N<-cbind(m,m[,ncol(m):1]),N[nrow(N):1,])
```
[Try it online!](https://tio.run/##K/qfpmCj@z@tNC@5JDM/TyNXsygpMy9Fw89GNxnMyNXJjdbJS87PAUpZGcZq6vhF5xXll2v4AXk6sZr/0zRyE0uKMis0LHVA4rbGYMW2hpqaXHApQysziKQRRNJYJ6kSxA0JCnXV1PwPAA "R – Try It Online")
[Answer]
# APL+WIN, 11 bytes
Prompts for a 2d array of integers.
```
m⍪⊖m←m,⌽m←⎕
```
[Answer]
# [Stax](https://github.com/tomtheisen/stax), 5 bytes
```
:mm:m
```
[Run and debug it online](https://staxlang.xyz/#c=%3Amm%3Am&i=%5B%22123%22%2C%22456%22%5D%0A%5B%221%22%5D%0A%5B%229%22%2C%229%22%2C%229%22%5D&a=1&m=2)
`:m` means mirror, which is `input.concat(reverse(input))`. `m`, in this context means output each line after applying...
So, mirror the array of rows, and then mirror each row and output.
[Answer]
# [Japt](https://github.com/ETHproductions/japt), 6 bytes
```
mê1 ê1
```
[Try it here](https://ethproductions.github.io/japt/?v=1.4.5&code=beoxIOox&input=W1sxLDIsM10sWzQsNSw2XV0KLVI=)
---
## Explanation
```
           :Implicit input of 2D array
m          :Map
 ê1        :  Mirror sub array
    ê1     :Mirror main array
```
[Answer]
# [Mathematica](https://www.wolfram.com/mathematica/), 29 bytes
```
(g=#~Join~Reverse@#&)@*Map[g]
```
[Try it online!](https://tio.run/##y00syUjNTSzJTE78n2b7XyPdVrnOKz8zry4otSy1qDjVQVlN00HLN7EgOj32f0BRZl5JdJqCg0J1taGOgpGOgnGtjkK1iY6CqY6CWW1t7H8A "Wolfram Language (Mathematica) – Try It Online")
[Answer]
# [SOGL V0.12](https://github.com/dzaima/SOGLOnline), 2 [bytes](https://github.com/dzaima/SOGL/blob/master/chartable.md)
*-1 byte thanks to dzaima.*
```
╬ø
```
[Try it here!](https://dzaima.github.io/SOGLOnline/comp/index.html?code=JXUyNTZDJUY4ZiUwQSV1MjE5MmY_,inputs=JTIyMTIzJTVDbjQ1NiUyMg__,v=0.12)
[Answer]
# [APL (Dyalog Classic)](https://www.dyalog.com/), 7 bytes
```
⍪∘⊖⍨⊢,⌽
```
[Try it online!](https://tio.run/##SyzI0U2pTMzJT9dNzkksLs5M/v@ob2pm/qO2CQb/04Dko95VjzpmPOqa9qh3xaOuRTqPevb@/18ClKh@1Lv1UeeiIiAz7VHvLiv1tMTMHHUgCyhe9Ki7RT0/W72WS@NR20QNQwUjBWNNDRMFUwUzTc0SuBAQGikYQiWA0FTBBI2DrAxoVu8qQ5h2Q00wARa0VABCiASIgZMAAA "APL (Dyalog Classic) – Try It Online")
[Answer]
# Java 8, ~~140~~ 131 bytes
```
m->{String r="";for(int a=m.length,b=m[0].length,i=a+a,j;i-->0;r+="\n")for(j=b+b;j-->0;)r+=m[i<a?i:a+a+~i][j<b?j:b+b+~j];return r;}
```
**Explanation:**
[Try it online.](https://tio.run/##lVDLboMwELznK1acQDYofUqN4@QLmkuPrg@GOKldbJAxqSrk/Do1gd5bafewOzPamdXiIvKmlVYfP8eqFl0Hr0LZYQWgrJfuJCoJh2kEePNO2TNUaUQYZxxMRiIQYsfqvPCqggNYoDCafDcsfEeThJwaN8lAUFPU0p79By6pYWv@OykqkMCaqDzfrYlDNHm3STbJNC1RSfRtn0XAMLUVe7WJfHRVnOltudebyEFXzYmTvncWHAkjmY21fVlHY4u/S6OOYGLEdLbHuMiWeN@dl6Zoel@0EfG1TW1RpVZ@wRJ4GO7wPX4IeHjET/g5hOz2gD9K/0d/iVfmXmRhFcYf)
```
m->{                      // Method with integer-matrix parameter and String return-type
  String r="";            //  Result-String, starting empty
  for(int a=m.length,     //  Amount of rows of the input-matrix
          b=m[0].length,  //  Amount of columns of the input-matrix
          i=a+a,j;        //  Index integers
      i-->0;              //  Loop over double the rows
      r+="\n")            //    After every iteration: append a new-line to the result
     for(j=b+b;j-->0;)    //   Inner loop over double the columns
       r+=                //    Append the result with:
          m[i<a?          //     If `i` is smaller than the amount of rows
             i            //      Use `i` as index in the input-matrix
            :             //     Else:
             a+a+~i]      //      Use `a+a+i-1` as index instead
           [j<b?          //     If `j` is smaller than the amount of columns
             j            //      Use `j` as index in the input-matrix
            :             //     Else:
             b+b+~j];     //      Use `b+b+j-1` as index instead
  return r;}              //  Return the result-String
```
[Answer]
# [J](http://jsoftware.com/), 11 bytes
Anonymous tacit prefix function.
```
|:@(,|.)^:2
```
[Try it online!](https://tio.run/##y/qvpKeepmBrpaCuoKNgoGAFxLp6Cs5BPm7/a6wcNHRq9DTjrIz@a3IpcKUmZ@QrpCkYKRirGIJIBRMFUwUziLC6rgIQqsPUGCoYqhhilTEGyljikDFRsbPK1DM04voPAA "J – Try It Online")
`|:` transpose
`@(…)` the result of:
 `,` the argument followed by
 `|.` its reverse
`^:2` and all this done twice
[Answer]
# [SNOBOL4 (CSNOBOL4)](http://www.snobol4.org/csnobol4/), ~~119~~ 113 bytes
```
	T =TABLE()
I	X =X + 1
	I =INPUT	:F(D)
	OUTPUT =T<X> =I REVERSE(I)	:(I)
D	X =X - 1
	OUTPUT =GT(X) T<X>	:S(D)
END	
```
[Try it online!](https://tio.run/##K87LT8rPMfn/nzNEwTbE0cnHVUOTy5MzQsE2QkFbwZCL01PB1tMvIDSE08pNw0WTi9M/NATIA6q1ibADSikEuYa5BgW7anhqcloBCS4XiF5dkF6YWvcQjQhNBZAOTqtgkCmufi6c//8bGhlzmZiaAQA "SNOBOL4 (CSNOBOL4) – Try It Online")
Takes input as strings on STDIN, without spaces. This only works because the digits are `1-9` and would fail otherwise.
[Answer]
# [C (gcc)](https://gcc.gnu.org/), ~~114~~ 111 bytes
* Saved three bytes thanks to [Kevin Cruijssen](https://codegolf.stackexchange.com/users/52210/kevin-cruijssen); inverting the loops.
```
j,i;f(A,w,h)int*A;{for(i=h+h;i-->0;puts(""))for(j=w+w;j-->0;)printf("%d,",A[(i<h?i:h+h+~i)*w+(j<w?j:w+w+~j)]);}
```
[Try it online!](https://tio.run/##dY1BCsIwEEXXeoyAMGOmYFsVbFpLz1G6kEpMAtZSK1mU9OoxdSG4kNl8/vuPaaNb23pvSAsJFVlSqLtxW4lJPgbQheJK6Cg670T/Gp/AGOICTGG5FeYDsB@CIoFtrsSoqkHnqtRZMPmscWs5mNyWJgsGnw02KJy/X3QHOK1XEiDIdYNTTAmltKcDHV0ICX4/ip@Zo5jiP/BE4ZZBGnrn3w "C (gcc) – Try It Online")
# [C (gcc)](https://gcc.gnu.org/), 109 bytes (abusing ease of parsing)
* Thanks to [Kevin Cruijssen](https://codegolf.stackexchange.com/users/52210/kevin-cruijssen) for suggesting to only allow one-digit input integers; saved two bytes.
```
j,i;f(A,w,h)int*A;{for(i=h+h;i-->0;puts(""))for(j=w+w;j-->0;)putchar(A[(i<h?i:h+h+~i)*w+(j<w?j:w+w+~j)]+48);}
```
[Try it online!](https://tio.run/##dY3NCoJAFIXX9Riu7nWukD9FOZr4HNJCBJs7kIUZs5Dx1aexRdAizuZyvu9yuujadc5pYtlDTYYU8jCFtZz7@whcKqEkR9F5Jx@v6QlBgLgCXRphpP4A9KRT7Qh1A1yoinP/JBbG0AjQhal07mWxaLyI7IjSulvLA@C83fQAfq254BxTQilltKeD9UeC3z35o1mKKf4DT@SzCqnvrXsD "C (gcc) – Try It Online")
[Answer]
# [Charcoal](https://github.com/somebody1234/Charcoal), 5 bytes
```
θ‖Ｃ→↓
```
[Try it online!](https://tio.run/##ASkA1v9jaGFyY29hbP//zrjigJbvvKPihpLihpP//1tbJzEyMycsJzQ1NiddXQ "Charcoal – Try It Online")
Thanks to [ASCII-only](https://codegolf.stackexchange.com/users/39244/ascii-only) for a better input format.
[Answer]
# [Add++](https://github.com/cairdcoinheringaahing/AddPlusPlus), 30 bytes
```
D,f,@,bU€{r}B]{r}
D,r,@,dbR+
```
[Try it online!](https://tio.run/##S0xJKSj4/99FJ03HQScp9FHTmuqiWqdYIMHlolMEFEtJCtIGSqdkFhfkJFbqOFjpcHEaGjirlHBxJoV6lZVxcVan1YLYXJwgzVn5mXm1eVxAzSAWUD9EytjIOYuLSwVqip39//9K0dGWsTpcCgoIKlbpX35BSWZ@XvF/Xd2y1KJiINPWRM8QAA)
The footer simply transforms the nested array into the format in the question. Defines a function `f`, which expects a matrix (nested array) as an argument.
[Answer]
# [Uiua](https://uiua.org), 9 [bytes](https://codegolf.stackexchange.com/a/265917/97916)
```
⍥(⍉⊂∶⇌.)2
```
[Try it!](https://uiua.org/pad?src=0_2_0__ZiDihpAg4o2lKOKNieKKguKItuKHjC4pMgoKZltbMSAyIDNdCiAgWzQgNSA2XV0KCmZbWzFdXQoKZltbOV0KICBbOV0KICBbOV1dCg==)
```
⍥(⍉⊂∶⇌.)2
⍥(     )2  # run a function twice
      .    # duplicate
     ⇌     # reverse
   ⊂∶      # prepend
  ⍉        # transpose
```
[Answer]
# [Julia 0.6](http://julialang.org/), ~~55~~ 49 bytes
```
~i=i:-1:1
!x=[x x[:,~end];x[~end,:] x[~end,~end]]
```
[Try it online!](https://tio.run/##yyrNyUw0@/@/LtM200rX0MqQS7HCNrpCoSLaSqcuNS8l1roiGkTrWMUqQFlg4dj/DsUZ@eUKitGGCkYKxtYKJgqmCmaxXDBRS2sgRHANY7m4/gMA "Julia 0.6 – Try It Online")
`~(i)` is a function to create slice from `i` down to `1`.  
So `~end` gives the slice `end:-1:1`
`!(x)` is the function to do the rebuilding of the array.
[Answer]
# [V](https://github.com/DJMcMayhem/V), 12 bytes
```
yGæGPÎy$æ_|P
```
[Try it online!](https://tio.run/##K/v/v9L98DL3gMN9lSqHl8XXBPz/b2hkzGViasZlbmEJAA "V – Try It Online")
Explanation:
```
yG              " Yank every line
  æG            " Reverse the order of the lines
    P           " Paste what we yanked
     Î          " On every line:
      y$        "   Yank the whole line
        æ_      "   Reverse the whole line
          |     "   Move to the beginning of the line
           P    "   Paste what we yanked
```
]