File tree Expand file tree Collapse file tree 2 files changed +13
-8
lines changed Expand file tree Collapse file tree 2 files changed +13
-8
lines changed Original file line number Diff line number Diff line change @@ -43,13 +43,11 @@ the sorting function."}
4343 {:added " 1.1" }
4444 [inner outer form]
4545 (cond
46- (list? form) (outer (apply list (map inner form)))
47- (satisfies? IMapEntry form) (outer (vec (map inner form)))
48- (seq? form) (outer (doall (map inner form)))
49- (satisfies? IRecord form)
50- (outer (reduce (fn [r x] (conj r (inner x))) form form))
51- (coll? form) (outer (into (empty form) (map inner form)))
52- :else (outer form)))
46+ (list? form) (outer (apply list (map inner form)))
47+ (seq? form) (outer (doall (map inner form)))
48+ (record? form) (outer (reduce (fn [r x] (conj r (inner x))) form form))
49+ (coll? form) (outer (into (empty form) (map inner form)))
50+ :else (outer form)))
5351
5452(defn postwalk
5553 " Performs a depth-first, post-order traversal of form. Calls f on
Original file line number Diff line number Diff line change 1919 (w/prewalk #(if (keyword? %) (str %) %) (Rec1. 1 )))
2020 " Mirror Clojure behavior" )))
2121
22-
22+ (deftest test-preserves-meta
23+ (testing " Test preserves meta"
24+ (is (= (-> (w/prewalk identity [1 (with-meta [1 2 ] {:foo 3 })])
25+ (nth 1 ) meta)
26+ {:foo 3 }))
27+ (is (= (-> (w/postwalk identity [1 (with-meta [1 2 ] {:foo 3 })])
28+ (nth 1 ) meta)
29+ {:foo 3 }))))
You can’t perform that action at this time.
0 commit comments