(let [s (-> #{}
transient
(conj! (clojure.core/with-meta [-7] {:mynum 0}))
(conj! (clojure.core/with-meta [-7] {:mynum -1}))
persistent!)]
[(meta (s [-7])) (meta (first s))])
=> [{:mynum -1} {:mynum 0}]
基本上,“key”(通过集合的序列获取的值)保留了第一个 conj! 的元数据,而“value”(通过调用“key”获取的值)则携带第二个 conj! 的元数据。这**不**与不使用 transients 的行为相符。
(let [s (-> #{}
(conj (clojure.core/with-meta [-7] {:mynum 0}))
(conj (clojure.core/with-meta [-7] {:mynum -1})))]
[(meta (s [-7])) (meta (first s))])
=> [{:mynum 0} {:mynum 0}]
(found playing with zach tellman's collection-check)