Forum Discussion
The Diagonal Suite: Gentle thunking goes a long way!
It seems the forum is not accepting the .xlsx workbook I've attached.
Here it is:
Excel-Lambda/The Diagonal Suite.xlsx at main · Patrick2788/Excel-Lambda
- PeterBartholomew1Nov 01, 2025Silver Contributor
I finished up copy/pasting your text to the workbook module!
I returned the reverse diagonals individually for summation (as used for accounts receivable or depreciation schedules). I hadn't realised GitHub can return binary files.
- Patrick2788Nov 01, 2025Silver Contributor
I had considered including Traverseλ in the signature of ByDiagλ but pulled back because I thought anti-diagonal aggregations would not be common (and it would be one too many parameters). There seems to be a dearth of good diagonally arranged examples online (Unless I'm not searching with the right terms). I'll have a look at accounts receivable and depreciation schedules. Thank you!
- PeterBartholomew1Nov 01, 2025Silver Contributor
I think your use of thunks may well be closer to the original intent than mine. Although you define the code to generate multiple arrays, you only evaluate the ones selected by the use case. I think such 'code insertion' was central to the concept of thunks (any functional programmers out there might like to comment).
I have used thunks in a rather different manner. I actually use a LET variable to force the evaluation of the content before forming the thunk. My mindset is more one on "I may reference this data many times and wish to ensure that the processing is only performed once". I am, in effect, passing data by reference and avoid the prospect of disappearing down the rabbit hole performing recursive calculation as I go!
I find it very difficult to determine which strategy should perform the better and suspect it is case-specific.
The examples of anti-diagonal (weighted) summations I quoted, fit into a pattern of discrete convolutions. Ultimately one can resort to Fast Fourier Transforms but that is far removed from the benefits of thunking you set out to convey!
BTW, I really enjoy your coding!
- PeterBartholomew1Nov 01, 2025Silver Contributor
My xlxs was stripped out too! This site is getting flaky!