Skip to content

Instantly share code, notes, and snippets.

//ref: https://codereview.stackexchange.com/q/199771
solver=LAMBDA(grid,
LET(numbers,SEQUENCE(9),
numgrid,SEQUENCE(9,9,0),
pos,XMATCH(0,TOCOL(grid*1))-1,
IF(ISNA(pos),
grid,
LET(i,INT(pos/9),
j,MOD(pos,9),
//Ex 1: https://exceljet.net/functions/webservice-function
Eval=LAMBDA(x,EVALUATE(x));
xml=Eval("WEBSERVICE(""https://www.nasa.gov/rss/dyn/breaking_news.rss"")");
//Ex 2: https://www.w3resource.com/JSON/introduction.php
Book=LAMBDA(index1,[index2],[index3],
SWITCH(index1,
"Title", "The Cuckoo's Calling",
"Author", "Robert Galbraith",
"Genre", "classic crime novel",
// Lookup worksheet and macro function information
// Resources:
// https://learn.microsoft.com/en-us/office/client-developer/excel/welcome-to-the-excel-software-development-kit
// https://support.microsoft.com/en-us/office/excel-functions-alphabetical-b3944572-255d-4efb-bb96-c6d90033e188
// https://www.myonlinetraininghub.com/excel-4-macro-functions
// https://github.com/lhem/excel/wiki/Functions
// Notes:
// legacy functions included e.g. =fnLookup("SINGLE")
@lhem
lhem / FSTACK
Last active October 1, 2023 09:41
fast stacking arrays
/*
An extension of the BYROW function that efficiently stacks arrays of results
Background:
An example of a fold that generates integers from 1 to 2^n is,
=REDUCE(1,{0,1,2},LAMBDA(j,i,VSTACK(j,j+2^i)))
A tree fold replaces the integer arrays with list functions j -> a(j),
=REDUCE(LAMBDA(j,j),{0,1,2},LAMBDA(a,i,LAMBDA(j,VSTACK(a(j),a(j+2^i)))))(1)
|
// Various Implementations for extensions of BYROW
BYROW.N=LAMBDA(i,
CHOOSE(i+1,BYROW0,BYROW1,BYROW2,BYROW3,BYROW4,BYROW5)
);
// 0. REDUCE / VSTACK
BYROW0=LAMBDA(array,function,
DROP(
REDUCE(