[Question]
  [
*[Rip-off](https://codegolf.stackexchange.com/q/193315/43319) of a [rip-off](https://codegolf.stackexchange.com/questions/193021/i-reverse-the-source-code-you-negate-the-input) of a [rip-off](https://codegolf.stackexchange.com/q/192979/43319) of a [rip-off](https://codegolf.stackexchange.com/q/132558/43319). Go upvote those!*
Your task, if you wish to accept it, is to write a program/function that outputs/returns its input/argument¹. The tricky part is that if I transpose your source code², the output/result must be transposed too.
1. You may choose which kind of 2D data your solution can accept. For example a list of lists, a matrix, a list of strings, etc. State which one(s) it handles. You may assume that the input will always be rectangular and will have a length of 1 or more along each dimension.
2. For the purposes of transposing, short lines in your source code will be considered as padded with trailing spaces until it is rectangular, however, these padded trailing spaces do not contribute to your code length.
Since this is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"), the target is to optimize the byte count of the original source code (not the transposed version).
## Examples
Let's say your solution takes a numeric matrix and your source code is
```
AB
DEF
```
and its input/argument is `[[1,2],[3,4],[5,6]]`. If I write
```
AD
BE
 F
```
instead and run it, the output/result must be `[[1,3,5],[2,4,6]]`.
Let's say your solution takes a linefeed-separated string and your source code is
```
ABC
```
and its input/argument is `"96\n"`. If I write
```
A
B
C
```
instead and run it, the output/result must be `"9\n6\n"`.
  
[Answer]
# [Python 3](https://docs.python.org/3/) + numpy, 45 bytes
```
lambda\
a:a
ma= """
b.    "
dT"   "
a "
\ """
```
[Try it online!](https://tio.run/##HYuxCsMwDER3fYXQZENrmnYr@C86elGI0wRqRTjOkK931R4c9@Du9GzLJo8@x9Q/XMaJE/CToXBEIoIxoIlgetE/2Zx@TV@LbrWhHEVP5B1FwV4No1HgyvLObrj5UPO@sGZ3v@B18KB1leZmZ1Pv@xc "Python 3 – Try It Online")
*Thanks to @EriktheOutgolfer pointing out a bug of the previous version*
## Transposed:
```
lambda\
a:a.T  
ma= """
b     "
d "   "
a "    
\ """  
```
[Try it online!](https://tio.run/##HYs7DsMgEET7PcWICqQExU4XiVukpFnL@CMFvMK48OkJ9jRvpDcjZ1m29K6T8/XHcRjZE3/YfgGK7KCUogFXFI1QN/kmyF8WqGuULRekI8oJ3pGE2rfAtWY5c5qD7l7G5rAvLEH3Dzw7Q5LXVPSk29SY@gc "Python 3 – Try It Online")
The functions take a numpy matrix as input and output a numpy matrix. The solution does not rely on comments like many other solutions do but instead exploits multi-line strings.
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 2 bytes
Input is a list of lists. Thanks to Luis Mendo and Nick Kennedy for improving the answer.
```
ZZ
```
[Try it online!](https://tio.run/##y0rNyan8/z8q6v///9HRhjpGsTrRxjomQNJUxyw2FgA "Jelly – Try It Online") [Try it transposed!](https://tio.run/##y0rNyan8/z@KK@r////R0YY6RrE60cY6JkDSVMcsNhYA "Jelly – Try It Online")
The program transposes the input twice, returning the original input. The transposed version ignores the first line and only transposes once.
[Answer]
# [R](https://www.r-project.org/), ~~5~~ 4 bytes
```
#t
I
```
[Try it online!](https://tio.run/##K/qfZvtfuYTL83@6LZeyJ1eJAleaRnJSZl6KRrKGoY6RjrGmTrKGiY6pjpmmpiZXOm65/wA "R – Try It Online")
An R function, either the identity function `I` or the transpose function `t` when transposed. Footer on TIO shows output of both.
Thanks to @RobinRyder for saving a byte!
[Answer]
# [C (gcc)](https://gcc.gnu.org/), ~~209~~ ~~205~~ ~~203~~ 201 bytes
## Normal
```
f(n,L,r,c)char**L;{for(c=0;0?L+  c:c<n;c+=puts(""))for(r=0;0?r :L[c][r];r++)putchar(L[ c ][ r ]);}/*
          \\\      \\      1 [0][]      \ \\\  \   \\      1 <n          \  \\\\\\   r+-c c+-r    */
```
[Try it online!](https://tio.run/##ZY7LTsMwEEXXzVeMLIH8ivIobOpGCGhZ5Q8cL6pRA13UrSZmFeXbQ5wUBMKbmTv3zB1j@o44ji33utakUeDHgaSsTd9eiGOVm/ypVgC4wa03qKrrZ@g4Y0JEn2afYFNbdJacIaXERMQQXltAcBYInDBDJhP4eU3TfDdLLcDmzrrbcPGbP/7W/1qfE5YQUikCqpSiIbPx5AOcDyfPRdInK7z4LkD8Dshw7EIx3aigZ88vr0wD2@3f2GD@Y@UNK8r1w2MEJ363j83dfcbFvJOsWl5qmFOFiWq9qHJSw/gF "C (gcc) – Try It Online")
## Transposed
```
f 
( 
n 
, 
L 
, 
r 
, 
c 
) 
c\
h\
a\
r 
* 
* 
L 
; 
{ 
f\
o\
r 
( 
c 
= 
0 
; 
01
? 
L[
+0
 ]
 [
c]
: 
c 
< 
n 
; 
c 
+\
= 
p\
u\
t\
s 
( 
"\
" 
) 
) 
f\
o\
r 
( 
r 
= 
0 
; 
01
? 
r<
 n
: 
L 
[ 
c 
] 
[ 
r 
] 
; 
r 
+\
+ 
) 
p\
u\
t\
c\
h\
a\
r 
( 
L 
[r
 +
c-
 c
] 
[c
 +
r-
 r
] 
) 
; 
} 
/*
*/
```
[Try it online!](https://tio.run/##ZY/NTsMwEITPnadYWQLZSar8FC6kFQJaTrxBnENkNbSHupVjTlGePdhbhECVrNXMevZb2yw/jZnnniAJlpARPrg6roagQtU4aHQ6NhM@IVMTRkKvcea@5PCGUPBVUeI5xBqkBagFNTAtnjiz5kU161THkYvGl4bXGJgjNATvVf/57obv1iAbseE9DQNbFo5FzSKsSBn1u@Xvd@R11oFSmCXIMMFE64J10SpGTYQ8QZLPR@vp1B2tVBixMGc7eDKHzlHi94Mvm5Y2NIqX1zeRkdju3sVU38aqn1hZrR4eYzDkt7so7u5zqXgGi15WGTFV1dGtrq4Kbpq/AQ "C (gcc) – Try It Online")
[Answer]
# [Haskell](https://www.haskell.org/), 51 bytes
This version is valid, but will not halt when given `[]` as input.
```
f
--(:[|,<zabf=]f
--abx(y-i$]
-- ):x) pf;x[:x
 y =y
```
[Try it online!](https://tio.run/##y0gszk7Nyfn/P41LV1fDKrpGx6YqMSnNNhbET0yq0KjUzVSJBbIVNK0qNBUK0qwroq0quBQqFWwr/@cmZubZFhRl5pWopEVHG@kY6hjH6kQbAGmT2Nj/AA "Haskell – Try It Online")
### Transposed, 75 bytes
```
f---
 ---y
 (a
 :b)=
 [x:y
 |(x
 ,y)
 <-
 zip
 a$f
 b];
 f x
 = [
 ] :
 f x
```
[Try it online!](https://tio.run/##HYpBCsIwFET3c4pZdNFCAtW6iuYkn79IwWBoLUVdtNK7x4@bNzzmPdJ7us9zrdl7Dxp2sE1gGLsIyhbMj3YD3d6BN2u@ZQVTk8FRr2CmnZECKsNf6zOVJa6vsnyaLHJ2Jzeok972olp/ "Haskell – Try It Online")
# [Haskell](https://www.haskell.org/), 51 bytes
This version is valid, but crashes with `[]` as input for the transposed version.
```
f
--d[(idi)z[.]d!0
-- m!)|,<i0.$ !]
-- a! (_-p
 p=p
```
[Try it online!](https://tio.run/##y0gszk7Nyfn/P41LVzclWiMzJVOzKlovNkXRACigkKuoWaNjk2mgp6KgGAsSSFRU0IjXLeBSKLAt@J@bmJlnW1CUmVeikhYdbaRjqGMcqxNtAKRNYmP/AwA "Haskell – Try It Online")
[Transposed](https://tio.run/##FYo7CoAwEET7PcUIFgqJxE@pJ1kWCagY/CBqJd49rs3MMO/N/lrGdY1xstYSNA7CAHQE3rzuLEkIIdfzzXSYnpC3aj5BITtCURAkVU74VSdx82HvjjPsdzoxV6Y0tRh22o1I/AA "Haskell – Try It Online")
# [Haskell](https://www.haskell.org/), ~~75~~ ~~67~~ 57 bytes
*At least 7 bytes saved thanks to Ørjan Johansen*
This version outputs `[]` when given `[]` as input.
```
f
--[[d(i<di)z[.$!0
--]]=!)$|,<i0.d!]
-- ;[! >(_-p ]
 f=f
```
[Try it online!](https://tio.run/##DchLCoAgEADQvadQcFGgYZ9d2kWGIQKThiykWkV3N1cP3rbc@xpjzoFpDeArsp7qFxopTBlEJ2r5KUum8QLL8BEEn6pZJ46MBxfysdDp0kXnIwNAp1rVowJTHBDzDw "Haskell – Try It Online")
[Transposed](https://tio.run/##FYvLCsIwFET38xVTyKKFpMTHzsYfuVykUIPBWkp1Jf57vN3MizOP8f28z3OtOYQAmmRQlGnXi@UpCdg2DVg6cHBXm36tNX8Du8E@37IaHMG@V9BN4E5Hra@xLGndyvJxWeToD/6kXqL5WbX@AQ "Haskell – Try It Online")
[Answer]
# [Python 3](https://docs.python.org/3/), 51 bytes
```
lambda\
a:a
mz= '''
bi'   '
dp'   '
a('
 *
 a
\)'''
```
[Try it online!](https://tio.run/##JckxCoNAEAXQfk4x3fwv2ySmCniTbUaMZEE3i6yCXn4TSPWKV876/uS@zUNsi6/j5FH86bJeg5qZjMlU1WQqfx0m2om6RP6@lS3lCnQzXocvSLnsFSQD2YBb0DuDog/6IL8 "Python 3 – Try It Online")
Based on [Joel's approach](https://codegolf.stackexchange.com/a/193351/41024). The input is a `tuple` of `tuple`s, and the output is a `zip` (converted to a `tuple` over TIO for better visibility).
Transposed:
```
lambda  \
a:zip(*a)
ma='''  '
b       '
d '     '
a '      
\ '''    
```
[Try it online!](https://tio.run/##LcoxCsMwEETRfk8x3c4aNYlTBXwTNWtsE4GtiKAE4ssrEPtXr/jlWx/P3LdliG31bZwciOL3PRV2brL5oKqAyogjlQl6yk9BIv4b0Mor5Up2C@ePr0y5vCvNLJg18hJwtQD2ATezHw "Python 3 – Try It Online")
[Answer]
# [Perl 6](https://github.com/nxadm/rakudo-pkg), ~~20~~ 11 bytes
```
#&
*[
#Z
 ]
```
[Try it online!](https://tio.run/##K0gtyjH7n1upoJamYPtfWY1LK5pLOYpLIfa/NVdxYqVCmoaGhqGOkaaOhrGOCZA01THT1NS0/g8A "Perl 6 – Try It Online")
### Transposed
```
#*# 
&[Z]
```
[Try it online!](https://tio.run/##K0gtyjH7n1upoJamYPtfWUtZgUstOir2vzVXcWKlQpqGhoahjpGmjoaxjgmQNNUx09TUtP4PAA "Perl 6 – Try It Online")
Both functions work on list of lists.
`*[ ]` is a WhateverCode returning the zen slice of its argument, effectively the identity function.
`&[Z]` is the zip operator.
[Answer]
# [JavaScript (Node.js)](https://nodejs.org), 62 bytes
```
//m0()m  ]
//=](=a  )
//>.a>p( )
//mm,m/aa
//[ap./=[
   p  =>p
```
[Try it online!](https://tio.run/##ZY29bsMwDIR3PgVHClCkxP1ZAupFBA1EYhsOzEhwjKBv77JNhha5gbiPOB4vcpfbaZnaurvWc78NvMWoe3KKWCBGLsSC6MymIKnRr1X1GkXMZWkhcgZEbIic2qbrF@d88J1/Kz6/@w//WcoRAEYGOzA9p3LSDPsSVBoQiW/gbBXA2B5bJQmnn2bJDYpz8NBdFlwPPJB9cscHdjw@EYa60NyvOGEdLOdO9Xqrcx/mOtJkgb9s@D/evcRN2zc "JavaScript (Node.js) – Try It Online")
Improved with a different layout 
```
///// 
///// 
m=>m[ 
0].map 
((a,p 
)=>m. 
map//= 
  (a=> 
   a[p 
])) 
```
[Answer]
## Haskell, ~~185~~ 161 bytes
```
t i
 =
 i
af
 n m
 u a e i
 l p s d
 lu h=u
 (
 h
 e
 a
 d
 a
 )
 t
 h
 e
 n
 [
 ]
 e
 l
 s
 e
 m
 a
 p
 h
 e
 a
 d
 a
 :
 t
 (
 m
 a
 p
 t
 a
 i
 l
 a
 )
```
[Try it online!](https://tio.run/##ZY1LCsIwFEXndxVn4KBCJn4HQlcSMghYaTENxabrj0lQEJy8d7jcz@jX5xBCzolJ9CrXPyQis9jwDFUPLKzcC2yM/SY6MYpBeBW5vb1IXzUKK1zjINYKqo3Ft@g/e2vZ7teSGtXtT32e/RTpWV5TTOxIWHswR3Nyxp7NxVydy28 "Haskell – Try It Online")
Transposed:
```
t  a
 =if null(head a)then[]else map head a:t(map tail a)
i       u
     map
        h
      es=
        u
      id
```
[Try it online!](https://tio.run/##PYqxDsIwEEP3fIUHhiJlgQIDUr4kynBSD@XENarI9ftDoVG92H52pvpm1dYMIIcgL5RVdchME@hsmUtMrJUx04KdPm34FSPR7eIEu1b3t21ynSD3xDUcrN8gU5tJCgKWjxTDCYYYL/7qx@Tjzd/9I6X2BQ "Haskell – Try It Online")
No comments, no string literals, just some additional function definitions.
Edit: -24 bytes thanks to @Ørjan Johansen.
[Answer]
# [PHP](https://php.net/) (7.4), ~~114~~ ~~86~~ 70 bytes
My first ever experience doing something like this in PHP, there must be a better way I cannot see! Input is an array of arrays like `[[1,2],[3,4],[5,6]]`.
### Normal:
```
fn($a)=>$a/*
nu         /
(l
$l
a,
).
=.
>.
a$
ra
r)
a/
y*
_
m
a
p
(*/
```
[Try it online!](https://tio.run/##NcQ9CsMwDAbQ/TtFBw2WETb9XVKnBzEmaDEppEaYdOjp3S59w7PVxv1hqwFU06jNkXKaSaNHex/@ItwG2qACDkgBc4ASuqIzNOLjseAFhcH5OCbA@rPtS3dUXc5HORXJZ7n8vsqtFOZpfAE "PHP – Try It Online")
### Transposed (space padded):
```
fn($a)=>array_map(
null,...$a)/*    *
(                /
$                 
a                 
)                 
=                 
>                 
$                 
a                 
/                 
*/                
```
[Try it online!](https://tio.run/##jcw7DsMgEEXRflZBQQFoBMq3cXAWgpA1DXIkB42QU2T1hNrT5BavOMXjlfvjySsD6BJ7qUaTjTO1Rt/lTWygfrYNvffDg1MjB0YdCqCPpIAkWUlR0izpv/sgyQnrEwC3V92XZnQxKZ3wnDFd8Dr2hvecrZ36Dw "PHP – Try It Online")
[Answer]
# [Brain-Flak (BrainHack)](https://github.com/Flakheads/BrainHack), ~~382~~ ~~375~~ 337 bytes
*No comments!*
```
  ( <( <>)<> ><>) ({})  {}{}   {( )()<({}<{}<><>>{}<><>{}) ( <>) ({}<><( [ ]({}<{}( )<({}()<{}<><>>){} ><><{}<< ><> ( [ ]( <>)<>)>{}<>>>)){}>)> ( ){ {}[]} <>[]{
(({}({}  ( ))   <>( ))[( [ ])])({}[ ] [ ](   )  (   ) < ><>{}  <>(   ){{}()<( )( ({} {  [ ](   )   } <>)  (  (())  {{}()<{}    >}  )  ) >}    )}[] {} ( ){} ( ){}({}<>)<>([])}<>
```
[Try it online!](https://tio.run/##TVA7DkMhDNt7Co/J2O@EuAhieO3SqlKHroizp3Z4QyVEQmwnDvfv9vo8t8c7AjAUnuqlojLAxnRgzDHBYHDzwlrhIV5XECdVorNgaOiLRYX4VO0KZydGPYsSLPKa6dmQJLL4IOaDw1ufxFsfB1MveSFCX6wqadnDuxNishoCLppCDpJKdBZGGtIyMoyBPwVmLiKlmWaM3T0h1Jkcz4SRzmgvbe53fgA3sdadWUSc4hzHvC9xjdsP "Brain-Flak (BrainHack) – Try It Online")
For the input the first two numbers are the dimensions of the matrix and the remainder is the contents of the matrix. Output is given in the same format.
## Transposed
# [Brain-Flak (BrainHack)](https://github.com/Flakheads/BrainHack), 465 bytes
```
 (
 (
({
 }
<(
({
 }
<
>
)(
<
>)
 )
>
<
>
)<
 >
((
{
})
))
 [
 (
{
}[
{
}]
 )
 ]
 )
{(
({
 }
)[
(
)]
<
([
{
}]
<( 
{
}
<
>)
<
>
>(
{
}
<
>)
<
><
{
}>
)<
 >
({
 }
<
>
)<
 >
((
{
}
<
>)
<{
({
 }
[(
 )
]<
((
{
})
<(
{
}(
({
 }
)
<{
(
{
}[
(
)]
<(
{
}
<
>)
<
>
> 
)}
{
}<
 >
>)
<
>
<(
{
}
<(
<(
 )
>)
<
>
 {
({
 }
[(
 )
]<
({
 }
<
>
)
<
>>
)}
>
{
})
<
>
>)
>
)>
)}
{
}
>
)
>)
 }
([
 ]
)
{{
 }
{
}(
[
])
}{
 }
<
>(
[
])
{{
 }
 (
 {
 }
 <
 >
 )
 <
 >
 (
 [
 ]
 )
 }
 <
 >
```
[Try it online!](https://tio.run/##ZVE5DgMhDOznFZR2mbNCfARtsUmTKFKKtCve7jCGZXNIyPgYPKPh8prvz9t8fZgFQT2yIBTEkSBBhZciaC28ERESRLCgKLROMp/WKjNMRAaPy7pHMwQ61efSMVECk7aaW5N81ZHV4NrEfHB37NLHWUg5xaEs@j0kOLKpbFrkR0CAFracojdXkPDQgdYO/6SbRMbEXanrgK@rrdQZHEVLC/2oXlWr/L3rzZgUZd3X6zbnJ7XERdLoloh/QrO@T81sbwfbeTzayc5v "Brain-Flak (BrainHack) – Try It Online")
[Answer]
# [Japt](https://github.com/ETHproductions/japt), 2 [bytes](https://en.wikipedia.org/wiki/ISO/IEC_8859-1)
```
ÕU
```
[Try it](https://petershaggynoble.github.io/Japt-Interpreter/?v=1.4.6&code=1VU&input=W1sxLDIsM10sWzQsNSw2XSxbNyw4LDldXQotUQ) | [Transposed](https://petershaggynoble.github.io/Japt-Interpreter/?v=1.4.6&code=1QpV&input=W1sxLDIsM10sWzQsNSw2XSxbNyw4LDldXQotUQ)
```
ÕU     :Implicit input of string/array U
Õ      :Transpose U
 U     :Original U
       :Implicit output
```
```
Õ\nU     :Implicit input of string/array U
Õ        :Transpose U
 \n      :Reassign to U
   U     :Newly transposed U
         :Implicit output
```
[Answer]
# [Charcoal](https://github.com/somebody1234/Charcoal), 19 bytes
```
Ａ¿⁰«
‖⁰¿
↗⁰
¿⁰
⁰¿
«
```
[Try it online!](https://tio.run/##S85ILErOT8z5///9noWH9j9q3HBoNdejhmkgxn6uR23TgQwusDgXROjQ6v//o6OjlRydlHQUlFxc3ZRiY2MB "Charcoal – Try It Online") Takes input as an array of strings. Explanation: `Ａ` implicitly prints the explicit input, while `¿⁰` is a conditional, with `0` as the condition, which is therefore always false. `«` then starts a block of meaningless Charcoal code which never gets executed. (It might be possible to remove some of those bytes but in that case I'm not sure whether Charcoal would parse the program correctly.) Transposed, 17 bytes:
```
Ａ‖↗¿⁰«
¿⁰⁰⁰¿
⁰¿
«
```
[Try it online!](https://tio.run/##S85ILErOT8z5///9noWPGqY9apt@aP@jxg2HVnOBaQg6tJ8LQh5a/f9/dHS0kqOTko6Ckourm1JsbCwA "Charcoal – Try It Online") Explanation: Much the same as the previous program, except for the addition of the transpose command `‖↗`.
I have an alternative solution where both the original and transposed program are 18 bytes:
```
Ａ⊞υ”y
‖υ⁺y
↗⁺
⊞⁺
υ
```
[Try it online!](https://tio.run/##S85ILErOT8z5///9noWPuuadb33UMLeS61HDNCCrcReQ1TYdSHMBpUDU@db//6Ojo5UcnZR0FJRcXN2UYmNjAQ "Charcoal – Try It Online") Explanation: `Ａ` as above; `⊞υ` pushes a value to the predefined empty list (which doesn't affect the output); `”y` begins an arbitrary string (ends at end of program or matching `”`). Transposed:
```
Ａ‖↗⊞υ
⊞υ⁺⁺
υ⁺
”y
y
```
[Try it online!](https://tio.run/##S85ILErOT8z5///9noWPGqY9apv@qGve@VYuMPmocRcQcYEZXI8a5lZyVf7/Hx0dreTopKSjoOTi6qYUGxsLAA "Charcoal – Try It Online") Explanation: `Ａ‖↗` as above; `⊞υ` as above; the minor difference here is that I'm pushing concatenations of smaller strings, since I don't want to repeat the `”`.
[Answer]
# [Haskell](https://www.haskell.org/), ~~153~~ 144 bytes
(thanks, [Sriotchilism O'Zaic](https://codegolf.stackexchange.com/users/56656/sriotchilism-ozaic))
```
f
 [
 ]=
   [
   ];
    f(
     x:
      l)
       =(
        :)
         x l
-- :   z $
-- f   i f
-- [   p
-- ]   W
--     i
--     t
--     h
```
[Try it online!](https://tio.run/##PcoxDsIwDIXhPad4Q4dWSiVomYJyDgbLQwesRg1VBR0Qlw82EDz4/2R5nh7LNedSxIEcODrAAPDZNqT9BM/wLXL3A2JbhfA/6iey63sE5QuNUZQJYiTlZmDFxWCTKvaKudymtMbtnta9EaLBH/3Ing7aE3N5Aw "Haskell – Try It Online")
[Try it transposed!](https://tio.run/##y0gszk7Nyfn/P00BDnQhgEshOhZDSMEWrgzIgauwSoOrBQkrWCMZBxVS0KjAEFKwysEQUtAEWlGVWRCeWZIBE1LQsEJXBVRXoQKzhQshqgAz8X9uYmaebUFRZl6JSlp0tJGOoY5xrE60AZA2iY39DwA "Haskell – Try It Online")
[Answer]
# [Ruby](https://www.ruby-lang.org/), 35 bytes
```
#-sz##
->hip{
 hip  }
#{f
#ht*
#..h
```
[Try it online!](https://tio.run/##bY3LDoIwFAX39ysaCvJIKfGdmOCPEBYVacEgNLSYKPDtFatLN2c1Z6YfLk/Di@5apr7vGxyrF8YQn6tajoCWRWgGPHLAlY4AU1qZhQOelg/WIHsEiXiWZWuyIducZDuyJ4c8z0FYq0Wo0n0tqZJNrQM3CemdyXFqpsDx4qNyvCakRcV6NVPds1bJTpUfJFidbl3dhpGbgBy0QlYJ4hsXv7j4Ezdv "Ruby – Try It Online")
Hip to be square! (Almost)
Accepts ruby matrices as input (arrays of arrays)
[Answer]
# [APL (Dyalog Unicode)](https://www.dyalog.com/), 7 bytes
```
{⍵
⍉
⍵}
```
[Try it online!](https://tio.run/##SyzI0U2pTMzJT///P@1R24TqR71buR71dgLx1tr/6RCRTojgVoXa/8VFyUCxR20T1UEq1RXUgbJgcmutOhdQkitNAUSmg0gA "APL (Dyalog Unicode) – Try It Online")
Transposed:
```
{⍉⍵
⍵ }
```
Probably a rather boring answer, but anyway here it goes.
The inline function definition `{...}` can span multiple lines. In this case, each line is sequentially executed, but any line without an assignment `←` immediately returns its computed value. So the first function returns `⍵` while the second returns `⍉⍵`.
Even more boring answer would be the comment abuse:
# [APL (Dyalog Unicode)](https://www.dyalog.com/), 4 bytes
```
⍝⍉
⊢
```
No TIO is necessary, I guess...
[Answer]
# [Wolfram Language (Mathematica)](https://www.wolfram.com/wolframscript/), 13 bytes
```
#&(*
 *)
\
```
[Try it online!](https://tio.run/##y00syUjNTSzJTE78n2b7X1lNQ4vrfX@7gpYmV8z/gKLMvBKHNIfqakMdIKzVqTbSAUIgbQzkm9TW/gcA "Wolfram Language (Mathematica) – Try It Online") / [Transposed](https://tio.run/##y00syUjNTSzJTE78n2b7X/l9f3sMlxqXhhaXlub/gKLMvBKHNIfqakMdIKzVqTbSAUIgbQzkm9TW/gcA "Wolfram Language (Mathematica) – Try It Online")
[Answer]
# [Clean](https://github.com/Ourous/curated-clean-linux), 64 bytes
```
//i$
//mp
$ p=p
//ot
//rr
//ta
// n
//Ss
//tp
//do
//Ls
//ie
//b
```
[Try it online!](https://tio.run/##Jck7CgMhFIXhflZhIdgkuIIpkkwTsLMUiztqguALxymy@dxcSfNxfo5LAQrm6s8UWIZYUMrIFylzWzhra6NZB9E7MYBghdDHzPn6SqiZMRA76gF9sJVxZoy43YW9GPHYhLX4da8E7wOvT4Xbp0CO7h96eBX3Hw "Clean – Try It Online")
```
//$//////////
// //////////
import StdLib
$p=transpose
  p
```
[Try it transposed!](https://tio.run/##S85JTcz7n5ufUpqTqpCbmJn3X19fRR8OuPT1FZB4mbkF@UUlCsElKT6ZSVwqBbYlRYl5xQX5xalcCgoF/4NLEoGytgoqCtHR6o5O6rE60erOLuqxsf//JaflJKYX/9f19PnvUpmXmJuZDOFAjAIA "Clean – Try It Online")
[Answer]
# [Runic Enchantments](https://github.com/Draco18s/RunicEnchantments/tree/Console), 88 bytes
```
vrlril1-{)?\:',=4*?~r0[
i! '${U [0r/?*7̸0l{$
$ka6 ̹\!$,'/;? =  ̹
'              ̸
$
```
[Try it online!](https://tio.run/##KyrNy0z@/7@sKKcoM8dQt1rTPsZKXcfWRMu@rsggmitTUUFdpTpUIdqgSN9ey/zMDoOcahUulexEM4UzO2MUVXTU9a3tFWwVgDwudQUUcGYHF5fK//@OCsEKLgo6XIEK4QquQDpIIUQhEgA "Runic Enchantments – Try It Online")  
[Try it transposed!](https://tio.run/##DYxBCsIwAATv84otBIIl0giioEgQ9AGKItJexFMxeAjopeC79A/9UwwMzGkmvZ79Ped3b6wMqXoQdSPZBb0RcRh/YnbumKpiaA0T7wjJ0jUNq7DG1gG3ZDN@C8w9dSSUik@54Wlz3sprJ8dBF@2Ljzrp@gc)
Input is *space separated* for each value and *comma separated* for each row (newlines are optional) and supports both strings and (non-zero) numbers. This makes parsing the input easier as input is automatically broken by spaces and newlines. So for example, the input:
```
1 2 3 , 4 5 6 , 7 8 9
```
Would be represented in nested array form as `[[1,2,3],[4,5,6],[7,8,9]]`. Minimal support for jagged arrays (only the last one can be short), but as inputs are expected to be rectangular, this satisfies that requirement.
Output is represented in the same format (transposed version outputs with newlines, but its zero bytes different to use a space instead). Normal version has a trailing space, transposed version has a trailing comma and newline (due to the difficulty of determining when there is no more data to print).
Normal version does have modifier characters in weird places (eg. `7̸0`), but this is due to needing them in the right place when the source is transposed and the normal execution only utilizes the leftmost column of instructions.
### Explanation
Explanation of the transposed source will be in a non-transposed form. Arrows will represent IP directionality at the entrance and exit of various blocks.
```
→rlril1-{)?\:',≠4*?~r0[    Initial position. Read and parse input.
           ↓               Input loop exit and direction
```
The input is read, and when a `,` character is found, a new substack is pushed. This allows each stack to hold each row separately in memory. Enters next section from the top.
```
           ↓
.. '${̹L [0r/?*7≠0l{̹$       When no more input:
      ↑    ↓
```
`[0` (executed leftwards) sets up a an empty stack to act as a boundary between the first row and the last row and then rotates to the first stack (`{̹`) and starts printing elements and rotating stacks. The `i!` is not executed and `{̹L [0r` is only executed once. When a zero-size stack is found, the loop exits.
```
      ↑    ↓
$ka6  \!$,'/;?             Row separation formatting
```
When the empty-stack is found, a `,` and newline are printed, and value loop is re-entered. Execution order (mirrored for readability) where `.` is an un-executed command: `\',$!.6ak$?....../`. Changing `ak` to `'<space>` would print spaces instead of newlines.
Execution halts when the program attempts to write from an empty stack; this is why only last-row jagginess works correctly and why there is a trailing `,` in the output: the comma has already been printed before the program knows that there's no more data.
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E/wiki/Commands), 4 [bytes](https://github.com/Adriandmen/05AB1E/wiki/Codepage)
```
øø
q
```
[Try it online.](https://tio.run/##yy9OTMpM/f//8I7DO7gK//@PjjbUMYrViTbWMQGSpjpmsbEA)
```
øq
ø
```
[Try it transposed.](https://tio.run/##yy9OTMpM/f//8I5CrsM7/v@PjjbUMYrViTbWMQGSpjpmsbEA)
**Explanation:**
Unlike some of the other languages, newlines are simply ignored in 05AB1E, so I don't think a 2-byter is possible (although I'd love to be proven wrong).
```
ø    # Transpose the (implicit) input
 ø   # Transpose it back
  q  # Stop the program (and output the top of the stack implicitly as result)
ø    # Transpose the (implicit) input
 q   # Stop the program (and output the top of the stack implicitly as result)
  ø  # No-op, since the program has already stopped
```
[Answer]
# [Vyxal](https://github.com/Vyxal/Vyxal), 2 bytes
```
#∩
```
[Try it online](https://vyxal.pythonanywhere.com/#WyIiLCIiLCIj4oipIiwiIiwiW1sxLDJdLFszLDRdLFs1LDZdXSJd) or [try it online transposed](https://vyxal.pythonanywhere.com/#WyIiLCIiLCIjXG7iiKkiLCIiLCJbWzEsMl0sWzMsNF0sWzUsNl1dIl0=).
Receives a list of lists (a list of strings will work too).
*-2 bytes thanks to lyxal*
[Answer]
# [Python 3](https://docs.python.org/3/), ~~118~~ 95 bytes
Input and result are lists of tuples.
```
f=lambda i:i;"""
=              "
l              "
a
m
b
d
a
i
:
[
*
z
i
p
(
*
i
)
]
;
"
"
"""
```
[Try it online!](https://tio.run/##dVLBbsIwDL37K6xcmqAMCdh2KOoHTOK4G0NVadMR1qZREzbg51mSlg4mmkq15We/55dWn@yuUYtLIUq0baaMboygeVMIFgO64wGdFWkllTDpj7S71OgsF4aGSt/lzwoTrISidXbsMI5f4pS4EmNDUyvsoVW49g3Tan8wlq4Ylk2LvoJShWg2ECZC7mgfL@C3nBpdSRsw2sv0EuRDkem@kYpGURd9173WWWo66XwwgDLNTGpsK9Wn04yi6FImVVZviwxlLJeEEEjw7hCo/hcyqGELhYsgIYY1TODsMg3UZRIYbGAJxD@EXJzGehY/zTZefLj@4m6Pv69ysx8D7YKl5H0YitEZ5viYh6MROoki51IcRX5PlTf6lJZOqryCjygY2NDiG7sJcO4TXNMZxznHBeNInzm@cHxlzlC/4JvSBxv7q@FYDWuXVPo6i/3GtGIDYG8AGwAQtbYnL/SYNMAjxB02Qn4F4Vvk1v0UnRXvYh7eC945GjHTTY0I9@CI8hW9/AI "Python 3 – Try It Online")
[Answer]
# [Cjam](https://sourceforge.net/p/cjam/), 13 bytes
```
qo
~
z
`
```
[Try it online!](https://tio.run/##S85KzP3/vzCfq46riivh///oaEMFo1iFaGMFk9hYAA "CJam – Try It Online")
## Transposed version:
```
q~z`
o
```
[Try it online!](https://tio.run/##S85KzP3/v7CuKoEr////6GhDBaNYhWhjBZPYWAA "CJam – Try It Online")
## Input format
The input format is the standard CJam array format: `[[1 2] [3 4]]`
# No crash version, 12 bytes
The normal version crashes *after* printing the array. A version which doesn't crash would be:
```
qo{
~
z
` };
```
[Try it online!](https://tio.run/##S85KzP3/vzC/mquOq4orQaHW@v//6GhDBaNYhWhjBZPYWAA "CJam – Try It Online")
or transposed:
```
q~z`
o
{  };
```
[Try it online!](https://tio.run/##S85KzP3/v7CuKoErn6taQaHW@v//6GhDBaNYhWhjBZPYWAA "CJam – Try It Online")
There are probably a few extra bytes that can be saved, i accidentaly worked on the transposed version first, which led to a few extra linebreaks and it's been a long time since i last used CJam. Any improvements welcome.
[Answer]
# [Zsh](https://www.zsh.org/), 75 bytes
```
  <<<${(F)@}
fa<
o[<
r+$
 +{
si(
;]F
i+)
==a
&$}
&s
r[
ei
p+
e1
a]
t
$
#
s
```
TIO: [Normal](https://tio.run/##JY69jsIwEIT7eYq9xCKxfFwELQ6iIS0PEKUIwVFcECOv@REozx4Mt1pNMbOjb588zFv6K4InrSnbH6oM6U9xZV8c7ViY8UbPeEIx1eKVV3I3oW81XK3hlQCpF9jm2DQVrJIoyxYLMWHB8DWMxUXBrNA2CIBACp4jA91wdidSjy8Z@PLdaCjcHYUhOhGXlZ/JgJQuLTPZEJeJ3dV3hjp3Mv@9JP61kx/pZSJyHbxMpnr9u1w1UzK/AQ "Zsh – Try It Online") [Transposed](https://tio.run/##LY2xDoIwGIT3/yl@SyM0FQlxtBgWWX0AwoBaUgapaasSCM9eK/EuueEuuW@yyp9wnzmDQmB8vlQxRJvsZU127YdMDm@crAIrHaajx04btMe@2G6NfMrWIY0sYFtz3je8oLbued6AEILOScXaBUQwhRkSqIBBCQv4wICbeug78nElA6x8PUh0H41OhSZcxMWq@D@TcFmyX3SM0EQ4w8hSH3Zp3izEfwE "Zsh – Try It Online")
The garbage below the main print is harmless, it prints an error when encountering a newline after `fa<` and exits. [86 bytes to remove that error.](https://tio.run/##NU5BasMwALvrFVpimgYvC911zuhlu@4BIYfMdYmhs4PttqGjb88S6ITQQUhItzjM73ypnU@BSrH4@PoskD/V5xjqb@tq4y68LSHSTEZzDNYlVieKPY79BN8aBKlBiWhHvHUBVlo0jcNGJGwiEdoKxp4wSsLsBPquRwIEcsR5mYMefvyBcnrcAB53vDNMV880LJ5SqmhWFEDOsY@RNi2MjP4ctKH2B/PfzMTvdl@uciwzsVWrWWb39vW52nX3bP4D "Zsh – Try It Online")
The transposed version is here. After printing it errors on seeing `<` at the end of a line and exits.
```
 for s;i=&&repeat $#s
 a[++i]+=$s[i+1]
<<<${(F)a}
<
<
$
{
(
F
)
@
}
```
[Answer]
# [Pyth](https://github.com/isaacg1/pyth), 10 bytes
```
CCQ "
Q
"
```
[Try it online!](https://tio.run/##K6gsyfj/39k5UEGJK5CLS@n//@hoQx0Fo1gdhWhjHQWT2Nh/@QUlmfl5xf91UwA "Pyth – Try It Online")
# Transposed
```
CQ "
C
Q
"
```
[Try it online!](https://tio.run/##K6gsyfj/3zlQQYnLmSuQi0vp///oaEMdBaNYHYVoYx0Fk9hYAA "Pyth – Try It Online")
## Explanation
The program transposes the input twice, returning the original input. The transposed version only transposes once.
]