Visitar URL original
more leveraging of transient propagation of meta · clojure/clojure@98d735f · GitHub
Skip to content

Commit 98d735f

Browse files
committed
more leveraging of transient propagation of meta
1 parent 8ccd738 commit 98d735f

1 file changed

Lines changed: 13 additions & 15 deletions

File tree

‎src/clj/clojure/core.clj‎

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7198,13 +7198,12 @@ fails, attempts to require sym's namespace and retries."
71987198
(persistent! (reduce conj! (transient to) from))
71997199
(reduce conj to from))))
72007200
([to xform from]
7201-
(if (instance? clojure.lang.IEditableCollection to)
7202-
(let [tm (meta to)
7203-
rf (fn
7204-
([coll] (-> (persistent! coll) (with-meta tm)))
7205-
([coll v] (conj! coll v)))]
7206-
(transduce xform rf (transient to) from))
7207-
(transduce xform conj to from))))
7201+
(if (instance? clojure.lang.IEditableCollection to)
7202+
(let [rf (fn
7203+
([coll] (persistent! coll))
7204+
([coll v] (conj! coll v)))]
7205+
(transduce xform rf (transient to) from))
7206+
(transduce xform conj to from))))
72087207

72097208
(alter-var-root #'into1 (fn [_] into))
72107209

@@ -8347,14 +8346,13 @@ fails, attempts to require sym's namespace and retries."
83478346
are mapped to result of applying f to the corresponding values of m."
83488347
{:added "1.11"}
83498348
[m f]
8350-
(with-meta
8351-
(persistent!
8352-
(reduce-kv (fn [acc k v] (assoc! acc k (f v)))
8353-
(if (instance? clojure.lang.IEditableCollection m)
8354-
(transient m)
8355-
(transient {}))
8356-
m))
8357-
(meta m)))
8349+
(persistent!
8350+
(reduce-kv
8351+
(fn [acc k v] (assoc! acc k (f v)))
8352+
(transient
8353+
(if (instance? clojure.lang.IEditableCollection m) m
8354+
(with-meta {} (meta m))))
8355+
m)))
83588356

83598357
(defn update-keys
83608358
"m f => {(f k) v ...}

0 commit comments

Comments
 (0)