Forum Discussion
What do you think of thunks?
I have my prejudices, but I would expect my approach to become stronger. If, say, XLOOKUP were used to identify first and last cells in each range, then the range ":" operator would return a variable length range for each mapped value. I could put the search criterial within a Lambda function to modularise the problem and then return the ranges within thunks (ranges, especially of varying size would throw an error within MAP).
I can then perform the calculations on the individual time slices of the data table with a second application of MAP (or, better, a custom version of MAP that expands the thunks automatically before passing the range to the function specified by the formula
MAPϑ
= LAMBDA(ϑ, FNλ,
MAP(ϑ, LAMBDA(ϑ, FNλ(ϑ())))
);
The strategy would be to break the calculation into a hierarchy of Lambda functions, each one with a well defined task. In essence, I propose to use thunks as a 'pass by reference' strategy, as opposed to 'pass by value'.
Isn't this statement the 'essence' of Thunks?
In essence, I propose to use thunks as a 'pass by reference' strategy, as opposed to 'pass by value'.
- PeterBartholomew1Jan 22, 2025Silver Contributor
Maybe. My thoughts only went as far as "I am using these objects as if they were variables passed by reference". I hadn't got as far as considering whether they might actually be that! My past experience as a FORTRAN programmer didn't involve much is the way of philosophy.