asso = <|"a" -> 1, "b" -> 2, "c" -> 3|>
asso // Query[{ "a", "b" }]
<|"a" -> 1, "b" -> 2|>
but
asso // Query[{ "a", "b" /* f }]
{1, f[2]}
While I would like to get:
<|"a" -> 1, "b" -> f[2]|>
and I would like the solution to be applicable also deeper when the query is ...
@Kuba LOL. I find working with Dataset and Association fascinating but potentially brain twisting. I catch myself looking up the documention like a newcomer everytime I start working with these things. Maybe I am getting old? :))
@Kuba I guess the way to think about the behavior, even if it doesn't explicitly do this, is to imagine that it splits the Optional into two definitions. g[s:{___}]:=s and g[]:=g[{}]. Then you will naturally remember the default value has to match the original pattern.
@Kuba Ah, interesting. I'm biased the opposite way I guess. If I'm in a rush I often forget about Optional and end up simulating it with multiple definitions anyway.