Mar 16 2021 08:25 AM
Is it possible to somehow include default values for LAMBDA functions with multiple parameters? For example, if my function is
=LAMBDA( height, width, height * width );
I would like to be able have "height" default to, say, "2" so I can call it with "4" and have it return "8".
Mar 16 2021 10:11 AM
SolutionIf only as
=LAMBDA(height,width,
IF(height, height,2)* width
)(,4)
Lambda allows optional parameters if you have more than one of them. Missed parameters are returned as zero.
Mar 16 2021 02:36 PM
Mar 16 2021 03:04 PM
Mar 16 2021 03:32 PM
Mar 16 2021 05:04 PM
First, thanks for the explanation of partial application. Now that you describe it, I remember running into this concept before, though under a different name. I will definitely revisit that.
In terms of the specific answer - IIUC, I would need to define, in addition to your Area2, another Area function to handle situations where both parameters are present, correct? What I'm trying to achieve is one function which can accept either Area(2,4) or Area(?,4) and, in either case, return 8.
Mar 16 2021 06:55 PM
Apr 20 2022 06:35 AM
Mar 16 2021 10:11 AM
SolutionIf only as
=LAMBDA(height,width,
IF(height, height,2)* width
)(,4)
Lambda allows optional parameters if you have more than one of them. Missed parameters are returned as zero.