From 0134656d0a78d5b5c92efa0bbbb53835984cfa82 Mon Sep 17 00:00:00 2001 From: Nathan Marz Date: Mon, 18 Apr 2016 12:18:47 -0400 Subject: [PATCH] minor code cleanup --- src/clj/com/rpl/specter/impl.cljx | 14 +++----------- test/com/rpl/specter/core_test.cljx | 2 +- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/src/clj/com/rpl/specter/impl.cljx b/src/clj/com/rpl/specter/impl.cljx index 2fb618e..bdd4acd 100644 --- a/src/clj/com/rpl/specter/impl.cljx +++ b/src/clj/com/rpl/specter/impl.cljx @@ -506,13 +506,9 @@ (defn all-select [structure next-fn] (into [] (r/mapcat next-fn structure))) -#+cljs -(defn next-fn-mapcat-transformation [next-fn] - (mapcat #(next-fn %1))) - #+cljs (defn all-select [structure next-fn] - (into [] (next-fn-mapcat-transformation next-fn) structure)) + (into [] (mapcat #(next-fn %)) structure)) #+cljs (defn queue? [coll] @@ -520,7 +516,7 @@ #+clj (defn queue? [coll] - (= (type coll) (type clojure.lang.PersistentQueue/EMPTY))) + (instance? clojure.lang.PersistentQueue coll)) #+clj (defn all-transform [structure next-fn] @@ -536,17 +532,13 @@ (->> structure (r/map next-fn) (into empty-structure)) ))) -#+cljs -(defn next-fn-map-transformation [next-fn] - (map #(next-fn %1))) - #+cljs (defn all-transform [structure next-fn] (let [empty-structure (empty structure)] (if (and (list? empty-structure) (not (queue? empty-structure))) ;; this is done to maintain order, otherwise lists get reversed (doall (map next-fn structure)) - (into empty-structure (next-fn-map-transformation next-fn) structure) + (into empty-structure (map #(next-fn %)) structure) ))) (deftype AllStructurePath []) diff --git a/test/com/rpl/specter/core_test.cljx b/test/com/rpl/specter/core_test.cljx index 34a0397..9e11022 100644 --- a/test/com/rpl/specter/core_test.cljx +++ b/test/com/rpl/specter/core_test.cljx @@ -775,6 +775,6 @@ (= s1 s2) (= (type s1) (type s2)) (= l1 l2) - (seq? l2) ;; Transformed lists are only guaranteed to impelment ISeq + (seq? l2) ; Transformed lists are only guaranteed to impelment ISeq (= q1 q2) (= (type q1) (type q2))))))