@trevor670 that's best done with a reduce
specter can help with the reducing function
(reduce
(fn [res m]
(setval [(keypath (:name m))
:args-list
NIL->VECTOR
AFTER-ELEM]
(:args m)
res))
{}
data)
Thanks @nathanmarz! I'm really new to clojure and found it so surprising that (map fn coll) doesnt preserve the original map! changes vectors to lists and lazy sequences! Very confusing for a beginner! While it might lead to some gaps in understanding idiomatic clojure, I've been finding spectre a lot easier to read and understand (from the perspective of a new learner) and things behave how I would expect them too! Thanks for making Spectre!
@trevor670 fwiw, i also experienced confusion initially, but once i focused on the distinction between collections and sequences, things started to make a lot more sense to me.
@nathanmarz Need some help with a recursive query: I have a map of maps which which stores top-level entities and entity details:
(def process-db {:process {:p1 {:name "P1"} :p2 {:name "P2"}}
:process-flow {:pf1 {:process_id :p1} :pf2 {:process_id :p2}}})
I want to get the process :name navigating from a process-flow-id.
(select [:process-flow MAP-VALS :process_id] process-db)
=> [:p1 :p2]
How do I write a select query that "loops back" to process-db, and does a lookup on [:process MAP-VALS :name]