APPLYN

=APPLYN(fn,n)

fn
a LAMBDA function of one variable
n
number of times to apply function

Applies a function to itself a prescribed number of times

tboulden

Board Regular
Joined
Jan 14, 2021
Messages
73
Office Version
  1. 365
Platform
  1. Windows
Using REDUCE makes it easy to recursively compose a LAMBDA with itself.

Excel Formula:
=LAMBDA(fn,n,
    REDUCE(
        fn,
        SEQUENCE(n-1),
        LAMBDA(composed,ignored,
            LAMBDA(x,composed(fn(x)))
        )
    )
)

LAMBDA_COMPOSE.xlsx
ABCD
1ValuenAPPLYN
211011
31100101
41510511
51511#NUM!<-Recursion depth limits still in place
Sheet1
Cell Formulas
RangeFormula
C2:C5C2=APPLYN(LAMBDA(x,x+1),B2)(A2)
 
Upvote 0

Forum statistics

Threads
1,224,836
Messages
6,181,251
Members
453,027
Latest member
Lost_in_spreadsheets

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top