Forum Discussion
What do you think of thunks?
Hi Matt
The formula works fine. It is something of a curiosity, given that during my career I probably wrote more matrix formulas than I did natural language paragraphs, that I don't use matrix multiplication more now. It is an extremely fast function even working well with1000x1000 arrays where it still kept up with a 1000 step SCAN. Mind you, explaining matrix multiplication to a lay audience can almost be as bad as explaining a thunk!
Rather perversely, I used a data dictionary comprising thunks to scroll though the variables of your LET function and examine the matrices.
=LET(
in_vals, dataValues,
in_roll_width, I1,
expanded_vals, VSTACK(
EXPAND(0, in_roll_width, , 0),
in_vals,
EXPAND(0, in_roll_width, , 0)
),
_count, SEQUENCE(ROWS(expanded_vals)),
_greater, expanded_vals > TRANSPOSE(expanded_vals),
_diag, ABS(_count - TRANSPOSE(_count)) <= in_roll_width,
max_locations, --(
DROP(
DROP(
MMULT(_greater * _diag, SEQUENCE(ROWS(expanded_vals), , 1, 0)),
in_roll_width
),
-in_roll_width
) = 2 * in_roll_width
),
out, FILTER(Data, max_locations),
dict, DB.DICTIONARYλ(
"expanded_vals", expanded_vals,
"count", _count,
"greater", _greater,
"diag", _diag,
"maxLocations", max_locations,
"out", out
),
DB.GETVλ(dict)(idx)
)
The 'dict' object can be returned as the result of the LET, or here I used a spinner to do the scrolling.
I have been trying to build generic capability but it is only too easy to miss the specific. Surveying the horizon is one thing, but it is not of much value if I trip over my shoelaces!
Something that I forgot to do: I added the data dictionary to help me understand Matt's formula (these days I often have problems understanding my own formulas, never mind someone else's!) I showed the added code, but perhaps it would have been of greater help to include the version of the workbook in which the LET data dictionary has been inserted so that others can decide whether it is useful or not.
My envisaged use case is that the dictionary would build as the LAMBDA/LET module is developed as a development/debug aid. Once one is sure of the functionality of the module, most of the objects would be removed from the reporting. Only the objects to be returned by the module would be left in.
The advantage of this use of the data dictionary is that it allows multiple data objects to be returned to the calling module, so permitting code to be modularised in a more rational structure.
All: I would love to know your thoughts on the idea of the data dictionary.