diff --git a/project.clj b/project.clj index ddf9dd5..5a8ef29 100644 --- a/project.clj +++ b/project.clj @@ -1,4 +1,4 @@ -(defproject com.rpl/specter "0.0.4" +(defproject com.rpl/specter "0.0.5" :dependencies [[org.clojure/clojure "1.6.0"] ] :jvm-opts ["-XX:-OmitStackTraceInFastThrow"] ; this prevents JVM from doing optimizations which can remove stack traces from NPE and other exceptions diff --git a/src/clj/com/rpl/specter/impl.clj b/src/clj/com/rpl/specter/impl.clj index b1bfb2f..6d8e7a3 100644 --- a/src/clj/com/rpl/specter/impl.clj +++ b/src/clj/com/rpl/specter/impl.clj @@ -142,11 +142,11 @@ (select* [this vals structure next-fn] (into [] (r/mapcat (partial next-fn vals) structure))) (update* [this vals structure next-fn] - (let [ret (r/map (partial next-fn vals) structure) - res (into (empty structure) ret)] - (if (list? structure) - (reverse res) - res + (let [empty-structure (empty structure) + pfn (partial next-fn vals)] + (if (list? empty-structure) + (map pfn structure) + (->> structure (r/map pfn) (into empty-structure)) )))) (deftype ValStructurePath [] diff --git a/test/clj/com/rpl/specter/core_test.clj b/test/clj/com/rpl/specter/core_test.clj index d7637fa..f2e67a3 100644 --- a/test/clj/com/rpl/specter/core_test.clj +++ b/test/clj/com/rpl/specter/core_test.clj @@ -75,7 +75,7 @@ (for-all+ [v (gen/list gen/int)] (let [v2 (update [ALL] inc v)] - (and (list? v2) (= v2 (map inc v))) + (and (seq? v2) (= v2 (map inc v))) ))) (defspec update-all-filter