This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-10-27
Channels
- # announcements (1)
- # aws (17)
- # babashka (2)
- # beginners (14)
- # calva (1)
- # cider (16)
- # clara (1)
- # clj-kondo (68)
- # cljdoc (2)
- # clojure (51)
- # clojure-dev (1)
- # clojure-italy (2)
- # clojure-spec (1)
- # clojure-uk (19)
- # clojurescript (34)
- # cursive (4)
- # fulcro (1)
- # heroku (3)
- # leiningen (36)
- # lumo (28)
- # music (2)
- # off-topic (16)
- # reagent (22)
- # specter (7)
- # sql (7)
@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]