User Profile
uziel9999
Copper Contributor
Joined Jun 16, 2022
User Widgets
Recent Discussions
Re: Lambda with offset does not work with a sequence
SergeiBaklan Thank you for your response. First, you might consider using FilterXML instead of the logic you posted. I think the results are the same with much less code, but maybe I am missing something. =LAMBDA(text,delim,FILTERXML("<x><y>" & SUBSTITUTE(text, delim,"</y><y>") & " </y></x>", "//y")) Regarding my original question, my goal was to take a string, split it to an array, then iterate over that array and apply it to some logic. For example, RemoveAll(str, "a b c") would split "a b c" to the array {"a","b","c"} and remove those letters from the string (str). The problem that arises is that offset does not work, so how can the tail be sent through a recursive lambda to the next iteration. My solution is to append a sequence to the array, filter on and then remove that column. I do not think it is particularly elegant, but it does work. Thoughts? ArrayHead LAMBDA(arr,[horizontal], LET( x, AND(OR(ISOMITTED(horizontal),horizontal=0),ROWS(arr)>1), a, IF(x,arr,TRANSPOSE(arr)), b, LET( aa, ROWS(a), bb, COLUMNS(a)+1, cc, SEQUENCE(aa), dd, MAKEARRAY( aa, bb, LAMBDA( x, y, IF( y=1, INDEX(cc,x,y), INDEX(a,x,y-1) ) ) ), ee, MAKEARRAY( 1, bb, LAMBDA( r, c, IF(c=1,0,1) ) ), ff, FILTER(FILTER(dd,INDEX(dd,,1)=1),ee), IF(x,ff,TRANSPOSE(ff)) ), b ) )2.8KViews0likes2CommentsRe: Lambda with offset does not work with a sequence
Riny_van_Eekelen thank you for your comments. It is good feedback. I am trying to understand how to cycle through an array. I have a lambda that breaks a string of words into individual elements. Later in the formula that array of elements is cycled through and used. How can it cycle through an array? The purpose of the offset is to identify the tail and to pass it to the recursion. So, if the formula takes the string "a b c" and splits that into the array {"a","b","c"}, what is the pattern that uses "a" and passes {"b","c"} to itself through recursion?3KViews0likes5Comments
Recent Blog Articles
No content to show