Skip to content

Commit 5b6ff8f

Browse files
committed
style
1 parent 0054a86 commit 5b6ff8f

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/java_time/defconversion.clj

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,8 @@
1010
vs)
1111

1212
(defn- to-seq [in]
13-
(if (sequential? in)
14-
in
15-
(vector in)))
13+
(cond-> in
14+
(not (sequential? in)) vector))
1615

1716
(defn- wrap-validation [from to f]
1817
(fn [vs]
@@ -26,11 +25,11 @@
2625
(let [res (to-seq (apply f vs))]
2726
(subvec res (first combo) (inc (last combo)))))
2827
(g/types (subvec xs (first combo) (inc (last combo))))
29-
(if (= (count idxs) (count xs))
30-
cost
28+
(cond-> cost
3129
;; TODO: mark as lossy conversion
3230
;; currently we just incur a 0.5*number of types dropped penalty
33-
(+ cost (* 0.5 (- (count xs) (count combo)))))))))
31+
(not= (count idxs) (count xs))
32+
(+ (* 0.5 (- (count xs) (count combo)))))))))
3433

3534
(def ^:dynamic *fail-on-duplicate-conversion?* true)
3635

0 commit comments

Comments
 (0)