Forum Discussion
ecovonrein
Jun 30, 2022Iron Contributor
HRECURSE instead of MAKEARRAY, recursing LAMBDA
I wish to share with the community some seriously goofy but generic LAMBDA code I created yesterday. By way of introduction, once you go down the route of SPILLed inputs, you very quickly arrive ...
Christopher Graham
Aug 20, 2023Copper Contributor
Thank you so much for the annotation! After a bit of trial and error (lots of errors), I was finally able to accomplish what I set out to do.
This specific application was actually column by column, so I switched to HSTACK and ended up using MAKEARRAY in the middle to build my columns after I defined the first.
This specific application was actually column by column, so I switched to HSTACK and ended up using MAKEARRAY in the middle to build my columns after I defined the first.
ecovonrein
Aug 22, 2023Iron Contributor
I am surprised that you can use MAKEARRAY to compute your columns. It means that every row performs the same calculation. Which strikes me as odd (before the mental picture of the original challenge which motivated HRECURSE.)
Anyway, glad to hear you got it done and our discussion proved useful to you.
Anyway, glad to hear you got it done and our discussion proved useful to you.
- Henrik_JeppssonDec 19, 2023Copper Contributor
You can recurse without using name manager:
=LET( Y,LAMBDA(G,X,IF(X>1,X*G(G,X-1),1)), F,LAMBDA(X,Y(Y,X)), F(5) )
Above is example with recursive factorial calculation.
Comes from lambda calculus and is called the theta combinator.
credit to hoover889 on reddit.