minor code cleanup
This commit is contained in:
parent
f048d23cda
commit
0134656d0a
2 changed files with 4 additions and 12 deletions
|
|
@ -506,13 +506,9 @@
|
||||||
(defn all-select [structure next-fn]
|
(defn all-select [structure next-fn]
|
||||||
(into [] (r/mapcat next-fn structure)))
|
(into [] (r/mapcat next-fn structure)))
|
||||||
|
|
||||||
#+cljs
|
|
||||||
(defn next-fn-mapcat-transformation [next-fn]
|
|
||||||
(mapcat #(next-fn %1)))
|
|
||||||
|
|
||||||
#+cljs
|
#+cljs
|
||||||
(defn all-select [structure next-fn]
|
(defn all-select [structure next-fn]
|
||||||
(into [] (next-fn-mapcat-transformation next-fn) structure))
|
(into [] (mapcat #(next-fn %)) structure))
|
||||||
|
|
||||||
#+cljs
|
#+cljs
|
||||||
(defn queue? [coll]
|
(defn queue? [coll]
|
||||||
|
|
@ -520,7 +516,7 @@
|
||||||
|
|
||||||
#+clj
|
#+clj
|
||||||
(defn queue? [coll]
|
(defn queue? [coll]
|
||||||
(= (type coll) (type clojure.lang.PersistentQueue/EMPTY)))
|
(instance? clojure.lang.PersistentQueue coll))
|
||||||
|
|
||||||
#+clj
|
#+clj
|
||||||
(defn all-transform [structure next-fn]
|
(defn all-transform [structure next-fn]
|
||||||
|
|
@ -536,17 +532,13 @@
|
||||||
(->> structure (r/map next-fn) (into empty-structure))
|
(->> structure (r/map next-fn) (into empty-structure))
|
||||||
)))
|
)))
|
||||||
|
|
||||||
#+cljs
|
|
||||||
(defn next-fn-map-transformation [next-fn]
|
|
||||||
(map #(next-fn %1)))
|
|
||||||
|
|
||||||
#+cljs
|
#+cljs
|
||||||
(defn all-transform [structure next-fn]
|
(defn all-transform [structure next-fn]
|
||||||
(let [empty-structure (empty structure)]
|
(let [empty-structure (empty structure)]
|
||||||
(if (and (list? empty-structure) (not (queue? empty-structure)))
|
(if (and (list? empty-structure) (not (queue? empty-structure)))
|
||||||
;; this is done to maintain order, otherwise lists get reversed
|
;; this is done to maintain order, otherwise lists get reversed
|
||||||
(doall (map next-fn structure))
|
(doall (map next-fn structure))
|
||||||
(into empty-structure (next-fn-map-transformation next-fn) structure)
|
(into empty-structure (map #(next-fn %)) structure)
|
||||||
)))
|
)))
|
||||||
|
|
||||||
(deftype AllStructurePath [])
|
(deftype AllStructurePath [])
|
||||||
|
|
|
||||||
|
|
@ -775,6 +775,6 @@
|
||||||
(= s1 s2)
|
(= s1 s2)
|
||||||
(= (type s1) (type s2))
|
(= (type s1) (type s2))
|
||||||
(= l1 l2)
|
(= l1 l2)
|
||||||
(seq? l2) ;; Transformed lists are only guaranteed to impelment ISeq
|
(seq? l2) ; Transformed lists are only guaranteed to impelment ISeq
|
||||||
(= q1 q2)
|
(= q1 q2)
|
||||||
(= (type q1) (type q2))))))
|
(= (type q1) (type q2))))))
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue