Clojure 打嗝消失键命名空间

Clojure hiccup vanishing key namespaces

我正在将地图的键值打印到 html,但键名称空间正在消失,这是我不想要的。

layout 下面调用 hiccup 的 html5 来渲染:

(layout (str "Path " (:path/title path))
  [:h1 "Title: " (:title path) slug]
  [:p (str path)]       ; prints "{:db/id 17592186045542, :path/title "sdf"}"
  (println (keys path)) ; prints in terminal "(:db/id :path/title)"
  [:p (keys path)]      ; prints "idtitle" 
  (for [[k v] path] [:p k " " v]) ; prints "id 17592186045542" /n "title sdf" 
  (map (fn [[k v]] [:p k " " v]) path)))) ; same as above

(keys path)formap 调用中,键的“:db/”和“:path/”命名空间不会呈现。为什么?

我想这些键是隐式的 named,不像你在它们上面明确使用 str 的好情况。

也许你应该使用

[:p (str k) " " (str v)]

或者简单地说:

[:p (str/join " " [k v])]