LAMBDA functions and recursion  calling a SELF function?
I would like to be able to call a lambda recursively on the grid without the name manager. a SELF function could refer to the function being written. Is that possible? Here's an example for factorial,
FACTORIAL: LAMBDA(n, IF(n = 0, 1, n * SELF(n  1)))
Here's another for matrix exponentiation,
MPOW:
LAMBDA( A, p,
IFS(
OR(ROWS(A)!=COLUMNS(A), p!=INT(p),p<0),
NA(),
p=0,
MUNIT(ROWS(A)),
MOD(p,2),
MMULT(A,SELF(A,p1)),
TRUE,
LET(
B, SELF(A,p/2),
MMULT(B,B)
)
)
)
)
2 comments

First260 commented
LET does not permit recursion natively but one can define a 'fixed point combinator' to achieve this. A recent Microsoft Research blog entry shows how to implement recursion using only LET and LAMBDA without name manager,
https://www.microsoft.com/enus/research/blog/lambdatheultimataeexcelworksheetfunction/

Kenneth Barber commented
Can you do something like this? I don't have the right version of Excel to test this.
LET(FACTORIAL,LAMBDA(n,IF(n=0,1,n*FACTORIAL(n  1))),FACTORIAL)