Forum Discussion
Formula Challenge: Create a guitar fretboard diagram
This solution (first solution) reads very well. The consistency in the parameter names really helps me follow the parameter pass between functions. I played with changing the numbers in the ArrConst and sure enough the result still produces perfect blocks of numbers no matter the order.
I see the alternative solution has some similarities to the first one but differs in delivering the solution in 'Rubik'. I prefer the first solution because I think it reads a bit better and its version of 'Rubik' is very clean. I'm still trying to grasp the full potential of REDUCE and going beyond the limited notion I had of the function that can 'merely return a scalar'. REDUCE seems to be a cut above the other Lambda helper functions. Perhaps it wouldn't be as useful if the array of arrays limitation was lifted but it's very powerful.
I would consider the failure of SCAN, BYROW, BYCOL to generate nested or stacked arrays to simply be a gross failure in the original specification. It should have been obvious that the majority of applications of such functions requires arrays of arrays. The exceptions are when one is calculating (i) a single value such as a grand total, (ii) a 1D row or column vector, (iii) a homogeneous 2D matrix, typically using array operations such as MMULT.
REDUCE only aims at producing a terminal value so it is capable of processing a 2D array, column by column. The use of HSTACK, is an effective workaround to make REDUCE return the result that SCAN should have generated by default.
What it does not achieve, (see attached) is to provide support for the case that one uses array methods to simplify calculation, not add complexity!
- Patrick2788Dec 05, 2022Silver Contributor
It's interesting how REDUCE provides a workaround but SCAN cannot handle nested arrays. I view SCAN and REDUCE as 'sister' functions in some regards because in many cases I can "check my work" with REDUCE by swapping it out for SCAN.
I do like using REDUCE to spill when it's not intended to do so. It's a nice workaround but it should be easier, I agree with that. The other workaround being text manipulation which feels like cheating with how often I've resorted to using it. It's not quite using helper columns in legacy Excel but it's getting there!For me, BYROW/BYCOL are used sparingly. When I go through progressions in my head of which functions can be used to achieve a task, those two are near the bottom of Lambda helper functions. Although, I do like using BYROW with FILTER to simplify multiple column criteria.