Forum Discussion
BigSpill: A 92‑Function Excel LAMBDA Library for Dynamic Arrays
Hi Patrick2788 , as always I enjoy seeing what you have created. In light of the above and the comment about going to triple and quad I thought of an alternative to your Pairwise that can handle ROWS so you can just call it multiple times as needed:
PairRowsλ=
LAMBDA(
vector_1,
vector_2,
LET(
// Element counts
k, ROWS(vector_1),
k₂, ROWS(vector_2),
Size, k * k₂,
IF(Size > 1000000, #NUM!,
LET(
// Cartesian expansion
x, CHOOSEROWS(vector_1, INT(SEQUENCE(Size,,0)/k₂)+1),
y, CHOOSEROWS(vector_2, MOD(SEQUENCE(Size,,0),k₂)+1),
pairs, HSTACK(x, y),
pairs
))));So instead of being limited to a single column to get repeated it will pair full rows. Here is an example from your sample sheet where I added Toppings to your icecream...
I briefly considered creating CartesianNλ which would be capable of generating Cartesian products from 2+ sets (until product explosion is reached), but I like having separate functions with Pairwiseλ being lean and strict.
There's also the issue of Excel working on fixed arity. There's no solution that works for N sets other than to use a one parameter set bank that becomes messy. I gave recursion some thought but didn't see an elegant solution.
Triplewiseλ is much more nuanced and accommodating than Pairwiseλ in that it accepts the sets presented in any order (even if it doesn't make sense) and returns the triples in the same order as the input. Quadwiseλ is simple because it only needs to call Triplewiseλ and then resize the 4th set to match the triple. It has a lot of potential because it makes windowing very easy.