diff --git a/README.md b/README.md index 03f9d4e..4403b01 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ In `net.cgrand.xforms.io`: Add this dependency to your project: ```clj -[net.cgrand/xforms "0.18.1"] +[net.cgrand/xforms "0.18.2"] ``` ```clj diff --git a/project.clj b/project.clj index 66ed108..4baac99 100644 --- a/project.clj +++ b/project.clj @@ -1,4 +1,4 @@ -(defproject net.cgrand/xforms "0.18.1" +(defproject net.cgrand/xforms "0.18.2" :description "Extra transducers for Clojure" :url "https://github.com/cgrand/xforms" :license {:name "Eclipse Public License" diff --git a/src/net/cgrand/xforms/rfs.cljc b/src/net/cgrand/xforms/rfs.cljc index 7635912..9db799c 100644 --- a/src/net/cgrand/xforms/rfs.cljc +++ b/src/net/cgrand/xforms/rfs.cljc @@ -29,7 +29,14 @@ (defn minimum ([comparator] - (minimum comparator nil)) + (fn + ([] nil) + ([x] x) + ([a b] (cond + (nil? a) b + (nil? b) a + (pos? (#?(:clj .compare :cljs cmp) comparator a b)) b + :else a)))) ([#?(:clj ^java.util.Comparator comparator :cljs comparator) absolute-maximum] (fn ([] ::+∞) @@ -40,7 +47,14 @@ (defn maximum ([comparator] - (maximum comparator nil)) + (fn + ([] nil) + ([x] x) + ([a b] (cond + (nil? a) b + (nil? b) a + (neg? (#?(:clj .compare :cljs cmp) comparator a b)) b + :else a)))) ([#?(:clj ^java.util.Comparator comparator :cljs comparator) absolute-minimum] (fn ([] ::-∞)