Replies: 2 comments
-
|
I see the same problem - With() quickly gets deeply nested. This is a good suggestion. Others thoughts? |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
This is an interesting idea. Wondering if we could use this change to improve SetFormula somehow. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hopefully this is where language implementation ideas go to live.
So the With function takes a record in its first argument which defines a record context that can be used in the second argument. I often find myself nesting with functions because I want to define a second set of variables based on the first set. My idea is to allow 2 or more arguments where the last argument is the same as current, but anything but the last argument is essentially a nested with, i.e. each argument provides a record context for all following arguments, preventing any need to nest multiple Withs.
So instead of
With({A:Some.Stuff,B:SomeOther.Stuff},With({C:SomeFormula(A,B)},SomeFormula(A,B,C)))we can doWith({A:Some.Stuff,B:SomeOther.Stuff},{C:SomeFormula(A,B)},SomeFormula(A,B,C))With({X:Value(Input.Text)}, With({LogX:Min(Int(Log(X,1000)),4)}, Round(X/1000^LogX,2) & Mid("kMBT",LogX,1) ) )With( {X:Value(Input.Text)}, {LogX:Min(Int(Log(X,1000)),4)}, Round(X/1000^LogX,2) & Mid("kMBT",LogX,1) )Beta Was this translation helpful? Give feedback.
All reactions