This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-10-16
Channels
- # announcements (7)
- # babashka (1)
- # beginners (25)
- # calva (7)
- # cider (15)
- # clj-kondo (13)
- # cljdoc (14)
- # clojure (151)
- # clojure-europe (4)
- # clojure-hamburg (2)
- # clojure-italy (22)
- # clojure-nl (57)
- # clojure-spec (12)
- # clojure-uk (6)
- # clojuredesign-podcast (5)
- # clojurescript (12)
- # core-async (8)
- # cursive (26)
- # datascript (9)
- # datomic (92)
- # emacs (4)
- # fulcro (7)
- # graalvm (1)
- # graphql (2)
- # instaparse (3)
- # jobs (1)
- # jvm (2)
- # kaocha (6)
- # nrepl (3)
- # off-topic (5)
- # re-frame (45)
- # reagent (5)
- # reitit (18)
- # ring (1)
- # shadow-cljs (89)
- # slack-help (9)
- # spacemacs (2)
- # sql (54)
- # tools-deps (75)
- # vim (28)
- # xtdb (17)
- # yada (31)
@neumann thanks a lot for the clarification and examples - very much appreciated. Could you also share the utility functions you use for namespaced maps (like selecting all keys with given ns)?
I don't have code from a project I can share, but I just whipped this up:
(defn select-keys-by-namespace
[m ns]
(reduce-kv
(fn [m k v]
(if (= ns (namespace k))
(assoc m k v)
m))
{} m))
=> (select-keys-by-namespace {:player/id 42 :player/name "Boom" :team/id 1001} "player")
#:player{:id 42, :name "Boom"}
Although in the future, I may be inclined to use: https://weavejester.github.io/medley/medley.core.html#var-filter-keys