Skip to content

Instantly share code, notes, and snippets.

@ExcelRobot
Last active August 7, 2024 18:09
Show Gist options
  • Select an option

  • Save ExcelRobot/c63eede7ce43538da78eb523daaaca5f to your computer and use it in GitHub Desktop.

Select an option

Save ExcelRobot/c63eede7ce43538da78eb523daaaca5f to your computer and use it in GitHub Desktop.
TILE Lambda
/*
Name: Tile (TILE)
Description: Tile the outputs of a single-parameter function given an array map of parameters.
Parameters:
params - array of parameters arranged how function results to be tiled
function - single-parameter Lambda name or function
Source: Excel Robot (@ExcelRobot), but inspired by Owen Price's STACKER lambda (https://www.youtube.com/watch?v=wEBLT9QfQRw).
*/
TILE = LAMBDA(params,function,LET(
firstrow, function(INDEX(params,1,1)),
stacker, LAMBDA(stack,param,VSTACK(stack,function(param))),
firstcol, IF(ROWS(params)=1,firstrow,REDUCE(firstrow,DROP(TAKE(params,,1),1),stacker)),
IF(COLUMNS(params)=1,firstcol,HSTACK(firstcol,TILE(DROP(params,,1),function)))
));
@eoehm

eoehm commented Jun 9, 2024

Copy link
Copy Markdown

image

@rodinski

rodinski commented Jul 6, 2024

Copy link
Copy Markdown

Nice. And good examples.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment