Forum Discussion
Formula Challenge: Create a guitar fretboard diagram
For some more practice with the method Peter has outlined in this discussion, I've attempted to apply this approach to a Rubik's cube exercise I've been playing with every now and then.
The goal is simply to create this array:
My previous solution involved creating the middle 1-4 blocks and then stacking and expanding the rest. Not exactly elegant but it got the job done.
With the new approach, I started with an array constant:
={5,"","",1,2,3,4,"",6,"",""}
Created a 3x3 matrix of blanks
=EXPAND("",3,3,"")
Created the Lambda called 'MStack', intended to be used in REDUCE
=LAMBDA(matrix,v,HSTACK(matrix, EXPAND(v, 3, 3, v)))
Next, comes a named item called 'Matrix'. My intent was to deliver the solution at this step, but it needed 1 more step.
=REDUCE(Blanks,ArrConst,MStack)
A Lambda - 'Rubik'
=LAMBDA(Stack,VSTACK(TAKE(Stack, , 12), TAKE(DROP(Stack, , 12), , 12), TAKE(Stack, , -12)))
Finally, at the sheet level:
=Rubik(Matrix)
This is the other approach I mentioned in passing. It uses your basic function to calculate each row of four faces individually before collecting them together using a further REDUCE/VSTACK.