Transform function with multiple nested expression functions using '_.'
AnsweredI as a user would like to use multiple functions which accept '_.' as the iterating value nested.
Currently you cannot for example use a filter with a nested map function, as the '_.' in the filter function will overwrite the '_.' in the map function.
Therefore I would like the option to use an alias for each nested function, or some other solution which gives the desired outcome.
An example using suggested alias method to iterate over a nested list:
["map", "alias_a",
["map", "alias_b",
["eq", "foo", "alias_b.key"],
"alias_a.inner_list"],
"nested_list"]
This would make it easier to write DTL because we would not have to define a rule for each nested expression which uses the '_.' operator.
-
Official comment
Do you have a real-world example where such a feature would be required?
We have considered adding a "let" function earlier, but have not done so yet as it is unclear if it is necessary or if it introduces too much complexity.
Comment actions
Please sign in to leave a comment.
Comments
1 comment