Skip to content

Instantly share code, notes, and snippets.

/* 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 */