trying to test myself with some (contrived) practice problems, would appreciate feedback on solutions (and also if you think I should just use vanilla clojure for the given situation), I still have a lot of blindspots I'm trying to illuminate:
current problem: lifting a nested map into its parent, more or less 'flattening' it
I feel like I might be using collect-one and view too much as a crutch (i even have a (def collect-view (comp collect-one view)) defined a few lines up), unsure if its the best way
maybe the function in the second view would be better as #(setval [:three :andmore] NONE %) so that its path matches the one the in collect-one, meaning I can parameterize it a little neater like so
(defn lift [m apath]
(transform [(collect-one apath)
(view #(setval apath NONE %))]
merge m))Specter is for targeted queries/transforms to data structures, but what you're doing here I would classify as "restructuring"
Specter can certainly help for use cases like this, but it won't be like the super concise paths for other use cases
this makes sense! I appreciate that clarification a lot, that helps define some boundaries for me and give me a little bit more of a hold on reality.
ah i actually like this
(defn lift [apath m]
(->> m
(transform (collect-one apath) merge)
(setval apath NONE)))