Special keyword to define mapping functions in expressions #1010
Labels
enhancement
Status: 3. Architecting
We’ve designed this. Now how do we implement it?
Topic: Formulas
We've often struggled with how to let authors define inline functions in expressions, the concept of an arrow function seeming too out of reach for them.
This would be useful for many things:
Note that unlike Coda, we don't need things like
CountIf()
orAll()
since we can always do things likecount(foo > 2) > 1
, but they may be useful as sugar.Coda’s formula language solves this in an interesting way: They allow for a special
CurrentValue
keyword, which essentially represents the closest list item. In Mavo’s syntax, presumably this could be$value
or$current
?There is the problem of referring to outer currentvalues, which they solve with a special scoping function. I think that's suboptimal, I can think of two alternative ways to deal with it, which can be combined:
$outer
keyword.$outer.$value
would be the outer$value
, and things like$outer.$outer.$value
would also be possible$value
is the default parameter name, but you can provide your own name by using this syntax".The text was updated successfully, but these errors were encountered: