Forum Discussion
Excel Labs Array Module - What are your thoughts?
Without playing with samples it's hard to comment concrete functions. First in mind, perhaps we may avoid MAP and FILTER in some cases, they are costly from performance point of view. For example,
replaceBlankCells =
LAMBDA(
array,
[replacement_value],
LET(
repl, IF(ISOMITTED(replacement_value), "", replacement_value),
IF( ISBLANK(array), repl, array)
)
);
For some could be variants which are bit easier in maintenance, at least from my point of view. e.g.
sliceCols =
LAMBDA(
original_array,
no_columns_to_drop,
[no_of_columns_to_take],
[no_columns_to_drop_from_end],
LET(
n, COLUMNS(original_array),
start, no_columns_to_drop + 1,
cols, MIN(no_of_columns_to_take, n - start + 1) -
no_columns_to_drop_from_end,
CHOOSECOLS(original_array, SEQUENCE(,cols,start))
)
);
Anyway, set of functions could be useful, thank you for sharing.
- joelb95Oct 23, 2024Brass Contributor
Thanks for taking a look. These functions are designed for working with dynamic arrays, so the array traversal logic is embedded (usually) in each of them. My replaceCell and replaceBlankCells, for instance, can replace any cell in an array (dynamic or otherwise) without having to separately call an array traversal function. Yes, it involves constructing a new array, but as far as I know, each "discrete" calculation creates its own array anyway (e.g. original_array, extra_row(vstack(original_array,"")), extra_row2(vstack(extra_row,"")) creates two new arrays while original_array, vstack(original_array, extra_row, extra_row2) creates only one new array).
The one function that I think is the biggest contributor going forward is the flatten function. It is presumably going to be the basis of all of my set theory module logic.