min (resp. max) now treats s as their absolute maximum (resp. minimum), so rf/min and rf/max are now associative and practically s are ignored.

This commit is contained in:
Christophe Grand 2018-06-15 18:15:50 +02:00
parent 0410484f90
commit 545b97ddf8
3 changed files with 18 additions and 4 deletions

View file

@ -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

View file

@ -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"

View file

@ -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
([] ::-∞)