Forum Discussion
BigSpill: A 92‑Function Excel LAMBDA Library for Dynamic Arrays
What is BigSpill?
BigSpill is an Excel LAMBDA library containing 92 functions across 10 categories, built from extensive experimentation with dynamic arrays. The goal is to provide elegant, efficient tools that make sheet‑level formulas easier to read, more modular, and more dynamic.
The library includes a mix of:
- quality‑of‑life helpers
- essential primitives
- mid‑level operators
- developer‑level tools
- a few functions you might not expect to see in Excel
Who is it for?
Everyone.
BigSpill aims to make complex operations more approachable and expressive.
A few examples from the library:
- Pairwiseλ
- Staircaseλ
- Grainλ
- PolarGridλ
- Convolveλ
- Foldλ
- Tessellateλ
- Revealλ
- Knapsackλ
- Magnifyλ
- Traverseλ
The repository includes full documentation and 11 sample workbooks so you can explore the functions without setup.
If you’re interested in experimenting with dynamic arrays, or LAMBDA workflows, feel free to take a look. Feedback and suggestions are always welcome.
I've attached 1 onboarding workbook. There are 10 more at the link below.
GitHub:
10 Replies
- Patrick2788Silver Contributor
Two new functions have been added with the release of BigSpill v1.1.0 .
Triplewiseλ Generates a Cartesian product from 3 sets
Quadwiseλ Generates a Cartesian product from 4 sets
All onboarding workbooks have been updated with the updated AFE module. The Grid Analytics onboarding workbook also now includes a demo of the two functions.There's a lot of potential uses for these two functions in set generation and creating indices.
- Patrick2788Silver Contributor
Pairwiseλ is my approach to generating a Cartesian product of 2 sets. Here is a demo with a deck of cards created from rank and suit.
The function is written as simply as possible. The goal was to make it fast, efficient, and predictable.
/* [GR06] ------------------------------------------------------------------------- Function: Pairwiseλ Category: Grid Analytics (Categorical Analysis) Author: Patrick H. Version: 1.1 Dependencies: Echoλ, Resizeλ Description: Creates vertical pairs from 1D and scalar inputs. Inputs are flattened with TOCOL to normalize orientation. 2D arrays are strictly prohibited. Parameters: vector_1 - 1D vector or scalar. vector_2 - 1D vector or scalar. ------------------------------------------------------------------------------*/ Pairwiseλ= LAMBDA( vector_1, vector_2, LET( // Flatten inputs v, TOCOL(vector_1), v₂, TOCOL(vector_2), // Element counts k, COUNTA(v), k₂, COUNTA(v₂), // Halting scenarios Is2DInput?, OR(AND(ROWS(vector_1)>1, COLUMNS(vector_1)>1), AND(ROWS(vector_2)>1, COLUMNS(vector_2)>1)), Is2Big?, k * k₂ > 1000000, IF(Is2DInput?, #VALUE!, IF(Is2Big?, #NUM!, LET( // Cartesian expansion x, Echoλ(v, k₂), y, Resizeλ(v₂, k), pairs, HSTACK(x, y), pairs )))));I have two more functions in the pipeline for the next update:
Triplewiseλ - Cartesian product of 3 sets
Quadwiseλ - Cartesian product of 4 sets
These two are of note because they provide an elegant way to generate indices. I'm toying with Windowedλ which extracts overlapping windows (n x n) from a 2D grid in row-major/col-major order. All will be in the next update.
- PeterBartholomew1Silver Contributor
I am hugely impressed by the level of effort that must have gone into preparing this compendium of spreadsheet techniques! I normally investigate an idea but fail to take it to the appropriate level of documentation for publication.
I have recently also worked on calculations that use convolution but presented it as deferred financial commitments rather than as a mathematical operation (I once did that using Fast Fourier Transformation).
DEFERREDλ = LAMBDA(current, spread, [initial], LET( _initialϑ, IF(ISOMITTED(initial), THUNK(HSTACK(0, 0 * spread)), THUNK(initial)), accountsϑ, SCAN(_initialϑ, current, LAMBDA(incomingϑ, expense, LET( distributed, expense * HSTACK(0, spread), committed, HSTACK(DROP(incomingϑ(),, 1), 0) + distributed, THUNK(committed) ) ) ), return, MAP(accountsϑ, LAMBDA(aϑ, @(aϑ()))), return ) );Rather than the 'sensible' approach of laying out the array and the kernel othogonally to generate a 2D array, I chose to work with an array of thunks!
- Patrick2788Silver Contributor
I appreciate the kind words! My goal with BigSpill is to get the functions out there and get the word out that Excel is a highly capable programming language.
I've downloaded your workbook and have been studying your approach to convolution with thunks. This is certainly a different mental model than the way I think through a problem. The elegance is impressive. It reminds me of your matrix flow accumulation solution - hydro flow. I may have more to say after I've had some time to digest the module.
I've been working on polishing Triplewiseλ/Quadwiseλ. The latter of which helps with making extraction of overlapped windows easier. This is a snip using djclements 's workbook from the Braille challenge.
- m_tarlerSilver Contributor
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...
- Patrick2788Silver Contributor
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.
- Harun24HRSilver Contributor
Visitors would be be benefited if you attached a sample file with sample data and output of each function. Little explanation would make the file excellent for visitors. Can you please share sample file and use of functions?
Edit: I got the sample files to your GitHub repository. Still I will advise to attach a sample file the post for easy way.
- Patrick2788Silver Contributor
Thank you for taking a look. I didn't attach sample workbooks here because the forum tends to gobble up attachments!