transformed
is, I think, the simplest way to do that
I'd love to be wrong though
I tried to do it the other way around, start navigating from :members
and then use selected?
but I don't think that works.
I have settled for calling select
twice in this case because I find the transformed
approach a little harder to parse
I mean, compare your transformed
solution to this:
(def structure
{:guild {:a {:members ["1234" "1235"]}
:b {:members ["2345"]}}
:members {"1234" 1
"2345" 2
"1235" 3}})
(select [:members (submap
(select [:guild :a :members ALL] structure))]
structure)
;; => [{"1234" 1, "1235" 3}]
That makes sense. It just would be nice imo to be able to get those keys from the collected values in a navigator rather than having to make a second select operation.