User Profile
tboulden
Iron Contributor
Joined Jan 18, 2021
User Widgets
Recent Discussions
Re: Would you recommend the use of Excel complex numbers where performance is required?
lori_m PeterBartholomew1 Apologies for my long absence! I'll have to dive-in on this over the weekend, but it looks pretty thrilling! Back once I've wrapped my head around it, or when I hit a brick wall and have a question!6KViews1like2CommentsRe: long texts with arrays in conditional functions
Sergei, you honor me with thinking I can be of help 🙂 However, if I understand the problem correctly, I think you're on the right track with MAP, and I'd venture that MAP vs BYROW internal workings exemplify the issue between your examples using 1 vs {1}. Assuming single column array for arr, I think MAP takes the value from each row-cell, however BYROW takes each row-cell as an array.3.4KViews0likes2CommentsRe: Array of arrays using Lambda helper functions
Sorry for the delay! I like this approach, had to refresh my memory on what territory we traversed in this thread. I agree about teaching to others, have been conversing with someone on a forum asking "why use thunks?" and asking for simple examples. I may have to show them this as it may be more accessible way of demonstrating. Hope 2022 has started off well for you!8.2KViews0likes1CommentRe: Accumulating arrays
PeterBartholomew1Much appreciated! I attempted to revamp my formula to go a similar direction if I'm reading you correctly, however it caused Excel to crash repeatedly. It was on a different machine, but it was something like the below; trying to add the error-handling for init_vals_arr being omitted, or promoting a single scalar to a rows_-length array are where I began experiencing glitchiness. Even tried operating from Excel for Web so Excel wouldn't keep crashing; I was able to import the LAMBDA editor manifest xml for the add-in, but it has no name manager available, so was at an impasse there as well. SCANBYROW =LAMBDA(init_vals_arr,array,fn, LET( rows_,ROWS(array), cols_,COLUMNS(array), thunk,LAMBDA(x,LAMBDA(x)), row_thunks,BYROW(array,thunk), scan_thunks, MAP(init_vals_arr,row_thunks, LAMBDA(init,row_thunk, thunk(SCAN(init,row_thunk(),fn))), MAKEARRAY(rows_,cols_, LAMBDA(i,j, INDEX( INDEX(scan_thunks,i,1)(), 1, j ) ) ) ) )4.4KViews0likes2CommentsRe: Accumulating arrays
PeterBartholomew1Howdy Peter, season's greetings! I did something similar with thunks and MAKEARRAY, see https://www.mrexcel.com/board/threads/scanbyrow.1183272/ for more detail. It assumes init is a scalar rather than an array of values, but could work with a few minor tweaks.4.6KViews0likes4CommentsRe: Is it time to revisit the Defined Name? I believe 365 requires a renaissance of the Name.
lori_m PeterBartholomew1 I wasn't able to fully hash out why I was getting the two entries, but I worked around it by deleting the Workbook scope entries manually. Some highlights: defineIt, a wrapper for DEFINE that hard codes everything but comment and scope nameDtl, a wrapper for DEFINITIONS that provides some dynamic filtering pseudo-Sheet Defined Function (SimplePivot tab): everything was defined using defineIt with local scope and step-by-step detail for building the pivot function is presented. pivot, a rudimentary pivot table LAMBDA function summarize, built to extract a subprocess of the original pivot algorithm shown on SimplePivot, and to resemble DAX function of same name fair amount of uses of thunks aggHelper can take custom LAMBDAs, so you can actually get much more specific aggregations that would require a data model and DAX some other helper functions Need to polish this a bit, but its all in working order currently, tell me if you notice something I missed or is not clear.1.2KViews0likes0CommentsRe: Is it time to revisit the Defined Name? I believe 365 requires a renaissance of the Name.
lori_m So far, so good; I made one successful modification to the Parse function to accomodate {,} for arrays as names. I'm struggling a bit with my other modification. I couldn't get the scope variable to register anything but "Workbook", so I Dim'ed a var ws for Worksheet and modified setNames to this: If IsEmpty(A(eScope, i)) Or A(eScope, i) = "Workbook" Then Set o = wbk ElseIf A(eScope, i) = "Local" Then Set o = ws End If This is working, but it is adding two entries: 1 with the local sheet scope and 1 with "Workbook" scope. I've tried figuring out where its doubling up, but not having success. Any ideas? Once I get this working, I've got a LAMBDA-based pivot table function I'll showcase here as well.5.2KViews0likes2CommentsRe: Is it time to revisit the Defined Name? I believe 365 requires a renaissance of the Name.
Excellent! I've incorporated the add-in and done some sample experiments, and glanced through the VBA; this seems quite nice, thanks for all your effort on this!! Will provide feedback and try to make myself a bit useful on this front!5.4KViews0likes4CommentsRe: Is it time to revisit the Defined Name? I believe 365 requires a renaissance of the Name.
lori_m PeterBartholomew1 Andy Gordon and Jack Williams from Microsoft Research revealed that the LAMBDA editor add-in they've been working on should be available via the Microsoft Store sometime in the near future. Video should be available https://excelvirtuallyglobal.com/access/, under the "ACCESS" section, first session, around hour 10 of the Teams recording. What they demo'ed today has syncing with GitHub, which would be helpful in managing LAMBDA versioning, but overall it looks like there are some nice improvements!5.5KViews0likes9CommentsRe: Is it time to revisit the Defined Name? I believe 365 requires a renaissance of the Name.
I like this idea also; I experimented a bit with creating a data type earlier this year, but it wasn't particularly user-friendly since its creating a table, loading to Power Query, creating the data-type, loading the data-type table back to the workbook, then referencing the data-type, which only gives back the text, but not an active formula, so you have to copy-paste-special, then modify, etc. I had thought originally since LAMBDAs were TYPE=128 and data types were as well that it would be apparent how to make them work together in a nice way.5.5KViews0likes11CommentsRe: Is it time to revisit the Defined Name? I believe 365 requires a renaissance of the Name.
PeterBartholomew1 lori_m Thanks for this new thread! I've not got much to contribute at this stage other than my agreement with the general sentiments expressed. I'm set to explore and play with the data-validation/VBA loading implementation and will come back with my experience notes, and revisit my early experiments debugging. One thing I thought might be useful to bring up since we're dealing with a functional approach is the concept of lenses. I've only read about them as a non-expert, but my understanding is that they allow for inspecting parts of data structures in a functional-friendly way. I believe there could be a GET lens to inspect name/value pairs either as local variables in LET or LAMBDA; similarly a SET or PUT lens might have a way of updating formula/definitions/etc from a functional programming perspective. I don't have any specific reference to share, but I did see that some implementation exists in TypeScript, so atleast it doesn't seem entirely outside the realm of possibility since I believe Calc.ts team revamped formulas/functions to behave with Excel on the web in TypeScript, and part of that is what's given us LAMBDA. lori_m Thanks for the link to Excel Virtually Global, I'm particularly intrigued by Charles Williams mysterious "lambda variables" title, but there are sure to be many useful tidbits.5.6KViews0likes0CommentsRe: A statement of truth or a wasted opportunity. Lambda helper functions reluctant to return 2D arrays.
lori_m Ahh, thanks for the clarification, I had never noticed the areas param in INDEX; I've confirmed both constructions, MAP across an area index and MAP across the EVALUATEd array of ranges. I couldn't think of a real-world specific use-case for the REDUCE/union construction, but set up a table and unioned all rows and all columns separately, then intersected them. Was surprised to see that its non-commutative in terms of order, but also makes sense in retrospect.2.3KViews1like9CommentsRe: A statement of truth or a wasted opportunity. Lambda helper functions reluctant to return 2D arrays.
PeterBartholomew1I went down a rabbit hole trying to play with MAKEARRAY since you mentioned it can't have a 0 value. I learned that you can omit both of the first two parameters, and that led me even further trying to see what possibly could go in for those parameters, even providing SEQUENCE formulae, etc. I was hoping to reverse-engineer MAKEARRAY based off the similarity to MAP of 2 parameters, but what I developed with MAP had sensical behavior, but I couldn't quite figure out what was going on with MAKEARRAY; exhibited on the MAKEARRAY tab of attached. I'm not sure I follow how to make it work with the 0 parameter. If the thunks aren't your cup of tea, check out the array_storage tab where I've put together a storage scheme to get dimensions of arrays and flatten them, and can revive the array from the storage array. lori_m I was able to use the union (,) operator, but could only get it working with thunks, see the union tab. I've not messed with union/intersection much, so not fully following your breadcrumbs, and my google searches didn't help much. Any references you can point me to, or suggest a specific INDEX construction? I wasn't sure what to do with OFFSET either.5.7KViews0likes11CommentsRe: A statement of truth or a wasted opportunity. Lambda helper functions reluctant to return 2D arrays.
PeterBartholomew1Re: Can a thunk refer to a previously calculated array, just waiting to be called, or should it be thought of as a recipe for calculating the array should it ever be required? I think I recall hearing Andy/Simon/someone along the way mention lazy evaluation?? And I think I recall that meaning that it stores the LAMBDA, but only evaluates it when needed. It's also possible that my brain made it up sometime during my research on lambda calculus implementations.5.7KViews0likes0CommentsRe: A statement of truth or a wasted opportunity. Lambda helper functions reluctant to return 2D arrays.
lori_mPlease see attached, modified EXPAND slightly to handle 2d arrays of thunks. You'll note that for most of these, SCAN omits the init_value; this can be overcome if absolutely necessary, but is an added complication. I've also included a version of reshape that I tried basing off np.reshape, but it still needs some polishing. =LAMBDA(array,[aRows],[aCols], LET( aRows_,IF(OR(ISOMITTED(aRows),aRows=""),1,INT(aRows)), aCols_,IF(OR(ISOMITTED(aCols),aCols=""),COUNTA(array),INT(aCols)), rows_,ROWS(array), cols_,COLUMNS(array), seq,SEQUENCE(aRows,aCols,0,1), r_,1+QUOTIENT(seq,cols_), c_,1+MOD(seq,cols_), reshaped,IFERROR(INDEX(array,r_,c_),""), result,FILTER(reshaped,BYROW(reshaped,LAMBDA(row_,NOT(AND(row_=""))))), result ) ) I'm enjoying these side-by-side comparisons, I've got another one for you, earlier this year I wrote a LAMBDA to extract subarrays of size [r x c] from a given array of size [m x n] in row-major order. Originally it was returning all subarrays, but since we hadn't figured out how to handle arrays-of-arrays, I was just using ARRAYTOTEXT, or subbing in an appropriate function to get back a single value. Now that we are thunking the arrays, I can provide an index list, and operate on specific subarrays. What would this look like in Python?5.7KViews1like17Comments
Recent Blog Articles
No content to show