This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-12-22
Channels
- # adventofcode (26)
- # aleph (34)
- # announcements (10)
- # babashka (71)
- # beginners (80)
- # biff (7)
- # calva (1)
- # cider (4)
- # cljdoc (12)
- # clojure (8)
- # clojure-belgium (1)
- # clojure-europe (11)
- # clojure-nl (3)
- # clojure-norway (18)
- # clojure-sg (3)
- # clojure-sweden (2)
- # clojurescript (18)
- # clojutre (4)
- # conjure (1)
- # core-logic (4)
- # datahike (1)
- # datascript (3)
- # emacs (27)
- # exercism (1)
- # gratitude (12)
- # introduce-yourself (4)
- # joyride (1)
- # lsp (46)
- # malli (3)
- # membrane (2)
- # nbb (1)
- # off-topic (3)
- # other-languages (7)
- # pedestal (4)
- # portal (3)
- # practicalli (1)
- # rdf (33)
- # re-frame (11)
- # releases (1)
- # ring (1)
- # scittle (34)
- # shadow-cljs (10)
- # squint (12)
- # tools-deps (89)
- # tree-sitter (2)
- # xtdb (14)
How do you namespace a pre-existing map turn this
{:id 1 :name "CBC"}
to this
#:company{:id 1 :name "CBC"}
That representation just means all of the keyword keys have the same namespace of company. Just update the keys of your map as needed
👍 1
(keyword "namespace/name")
you need to do that for each key in your map. (update-keys my-map (fn [k] (keyword "company" (name k)))
👍 1
FWIW I would be wary of programmatically namespacing keys in a map. you might have keys in there that you don't want to change the namespace to.
you can use clojure.set/rename-keys
to be explicit
(rename-keys {:id 1 :name "CBC"} {:id :company/id :name :company/name})
👍 2
True @U4YGF4NGM Or even non keyword types