Is there a way to perform a select that uses values from a selection to navigate? Like to select down one path, and then use the selected value to navigate down another?
Seems like collected?
is what I was looking for.
Actually, not quite. I'd like to be able to refer to both the collected?
values and the structure.
Say for example I want to query this structure:
{:guild {:a {:members ["1234"]}}
:members {"1234" 1}}
What I'd like to do is select along [:guild :a :members ALL]
and then use those values to then do [:members the-key]
on the original structure.It looks like this can be done with some effort by using the transformed
navigator
In this particular case, it would be done in this manner:
(select-one [(transformed [(collect :guilds MAP-VALS :members ALL)
:members]
#(select-keys %2 %1))
:members MAP-VALS]
structure)