Post History
MATL, 8 bytes tp:qwPe! Try it online! tp:qwPe! t : duplicate with implicit input (function args as array) p : product [2 3]p -> 6 : : range 1..n q : decremen...
Answer
#2: Post edited
# [MATL](https://github.com/lmendo/MATL), 7 bytes- ```
tp:wPe!- ```
[Try it online!](https://tio.run/##y00syfn/v6TAqjwgVfH//2hTBbNYAA)- ```
tp:wPe!t : duplicate with implicit input (function args as array)p : product [2 3]p -> 6: : range 1..nw : swap top of stackP : flip [2 3]P -> [3 2]e : reshape [1 2 3 4][2 2]e -> [1 3;2 4]! : transpose- ```
- Reshape fills columns instead of rows, hence the flip and transpose.
- # [MATL](https://github.com/lmendo/MATL), 8 bytes
- ```
- tp:qwPe!
- ```
- [Try it online!](https://tio.run/##y00syfn/v6TAqrA8IFXx//9oUwWzWAA)
- ```
- tp:qwPe!
- t : duplicate with implicit input (function args as array)
- p : product [2 3]p -> 6
- : : range 1..n
- q : decrement
- w : swap top of stack
- P : flip [2 3]P -> [3 2]
- e : reshape [1 2 3 4][2 2]e -> [1 3;2 4]
- ! : transpose
- ```
- Reshape fills columns instead of rows, hence the flip and transpose.
#1: Initial revision
# [MATL](https://github.com/lmendo/MATL), 7 bytes ``` tp:wPe! ``` [Try it online!](https://tio.run/##y00syfn/v6TAqjwgVfH//2hTBbNYAA) ``` tp:wPe! t : duplicate with implicit input (function args as array) p : product [2 3]p -> 6 : : range 1..n w : swap top of stack P : flip [2 3]P -> [3 2] e : reshape [1 2 3 4][2 2]e -> [1 3;2 4] ! : transpose ``` Reshape fills columns instead of rows, hence the flip and transpose.