This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-06-06
Channels
- # announcements (1)
- # atom-editor (2)
- # babashka (6)
- # beginners (30)
- # calva (12)
- # chlorine-clover (2)
- # clojure (88)
- # clojure-australia (2)
- # clojure-europe (9)
- # clojure-germany (4)
- # conjure (3)
- # cursive (12)
- # datomic (4)
- # lsp (86)
- # off-topic (48)
- # play-clj (8)
- # polylith (6)
- # reagent (11)
- # reitit (8)
- # shadow-cljs (19)
- # specter (6)
- # sql (13)
- # xtdb (25)
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)