This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* Reverses an n-dimensional array */ | |
| REVERSE_ARR =LAMBDA(my_array, | |
| LET( | |
| row_length, ROWS(my_array), | |
| col_length, COLUMNS(my_array), | |
| IF(col_length = 1, | |
| /* its a vertical list, reverse it*/ | |
| MAKEARRAY(row_length, 1, LAMBDA(row, col, INDEX(my_array, row_length - row + 1))), | |
| /* horizontal array */ |