Skip to content

Instantly share code, notes, and snippets.

@pbartxl
pbartxl / Inventory library
Created July 18, 2024 15:51
FIFO Lambda in Excel
/* FUNCTION NAME: Calculateλ
DESCRIPTION:*//**Builds tables of output costs from input and output tables*/
/* REVISIONS: Date Developer Description
01 Mar 2024 Peter Bartholomew Original Component
17 Jul 2024 Peter Bartholomew Major revision to tracking entries in combined table
*/
Calculateλ
=LAMBDA(
// Parameter Declarations
[outFlow], [inFlow], [unitCost], [option],
@pbartxl
pbartxl / SCANVλ.txt
Created August 28, 2024 22:09
Excel Lambda helper functions designed to return an array of arrays (normally a #CALC! error) by retuning the nested arrays as Lambda functions (thunks) before combing them pairwise as a binary tree.
/* FUNCTION NAME: SCANVλ
DESCRIPTION: Implements a version of SCAN that will return a column of arrays */
/* REVISIONS: Date Developer Description
19 May 2024 Peter Bartholomew Original Development
*/
SCANVλ = LAMBDA(
// Parameter Declarations
[y₀],
[x],
[FNλ],
@pbartxl
pbartxl / MAPλ.txt
Last active November 5, 2024 23:33
A version of Excel MAP helper function that will return an array of arrays
/* FUNCTION NAME: MAPλ
DESCRIPTION: Implements a version of MAP that will return an array of arrays */
/* REVISIONS: Date Developer Description
28 Aug 2024 Peter Bartholomew Adapted from BYROWλ to give MAPλ
31 Aug 2024 Peter Bartholomew JOINPAIRSλ modified to stack 2D result arrays
10 Sep 2024 Peter Bartholomew Modified to accept 3 array argumments before λ-function
*/
MAPλ = LAMBDA(
// Parameter Declarations
[array1],
@pbartxl
pbartxl / COMBINATIONAλ.txt
Created September 5, 2024 14:22
An Excel Lambda function that generates all the combinations of m objects taken from n. The result is returned as an array of binary numbers 1 = selected, 0 = omitted.
/* FUNCTION NAME: COMBINATIONAλ
DESCRIPTION:*//*Lists all comninations of m objects taken from n*/
/* REVISIONS: Date Developer Description
29 Mar 2024 Peter Bartholomew Original development
*/
/* REQUIRED: NextColumnAλ, ϑSTACKλ, THUNKλ, FINALVALUEλ,
*/
COMBINATIONAλ = LAMBDA(
// Parameter Declarations
[n],