Forum Discussion
Is it possible to define a function with no argument by LAMBDA?
- Aug 02, 2021
Yes, it seems to be possible. e.g. given a named reference 'x'
=LAMBDA(x+1)()
returns x+1.
=LAMBDA(x+1)
returns a #CALC! error.
If you name the Lambda function INCx then the same results are obtained for
=INCx()
and
=INCx
respectively. I think I have read of such functions being referred to as 'thunks' and would be used to pass a resource-intensive operation as a parameter without evaluating it before the result is needed.
The possibility of defining and testing for an optional parameter is being rolled out.
Yes, it seems to be possible. e.g. given a named reference 'x'
=LAMBDA(x+1)()
returns x+1.
=LAMBDA(x+1)
returns a #CALC! error.
If you name the Lambda function INCx then the same results are obtained for
=INCx()
and
=INCx
respectively. I think I have read of such functions being referred to as 'thunks' and would be used to pass a resource-intensive operation as a parameter without evaluating it before the result is needed.
The possibility of defining and testing for an optional parameter is being rolled out.
- Tie CHENGAug 02, 2021Brass ContributorIndeed, it is possible, thank you.