specter

Latest version: 1.1.3
2021-06-06T20:48:59.001200Z

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?

2021-06-06T21:08:49.001500Z

Seems like collected? is what I was looking for.

2021-06-06T21:11:29.002Z

Actually, not quite. I'd like to be able to refer to both the collected? values and the structure.

2021-06-06T21:24:10.004300Z

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.

2021-06-06T22:09:12.004700Z

It looks like this can be done with some effort by using the transformed navigator

2021-06-06T22:11:59.006700Z

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)