diff options
author | Rich Hickey <richhickey@gmail.com> | 2008-02-20 03:28:55 +0000 |
---|---|---|
committer | Rich Hickey <richhickey@gmail.com> | 2008-02-20 03:28:55 +0000 |
commit | 6ca4417c658452e1b1ed4ede084054607cae644e (patch) | |
tree | 524cdb5a4ad80e068bea58c871b996d17109e656 /src | |
parent | b207e23ee8da264ee38d92ad5d85b0e9975a10cc (diff) |
return false consistently on < <= > >= ==
Diffstat (limited to 'src')
-rw-r--r-- | src/boot.clj | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/src/boot.clj b/src/boot.clj index 11be0c18..774f58db 100644 --- a/src/boot.clj +++ b/src/boot.clj @@ -366,59 +366,64 @@ reverse [coll] (reduce - (- x y) more))) (defn - #^{:doc "Returns non-nil if nums are in monotonically increasing order, otherwise nil."} + #^{:doc "Returns non-nil if nums are in monotonically increasing order, otherwise false."} < ([x] true) ([x y] (. clojure.lang.Num (lt x y))) ([x y & more] - (when (< x y) + (if (< x y) (if (rest more) (recur y (first more) (rest more)) - (< y (first more)))))) + (< y (first more))) + false))) (defn - #^{:doc "Returns non-nil if nums are in monotonically non-decreasing order, otherwise nil."} + #^{:doc "Returns non-nil if nums are in monotonically non-decreasing order, otherwise false."} <= ([x] true) ([x y] (. clojure.lang.Num (lte x y))) ([x y & more] - (when (<= x y) + (if (<= x y) (if (rest more) (recur y (first more) (rest more)) - (<= y (first more)))))) + (<= y (first more))) + false))) (defn - #^{:doc "Returns non-nil if nums are in monotonically decreasing order, otherwise nil."} + #^{:doc "Returns non-nil if nums are in monotonically decreasing order, otherwise false."} > ([x] true) ([x y] (. clojure.lang.Num (gt x y))) ([x y & more] - (when (> x y) + (if (> x y) (if (rest more) (recur y (first more) (rest more)) - (> y (first more)))))) + (> y (first more))) + false))) (defn - #^{:doc "Returns non-nil if nums are in monotonically non-increasing order, otherwise nil."} + #^{:doc "Returns non-nil if nums are in monotonically non-increasing order, otherwise false."} >= ([x] true) ([x y] (. clojure.lang.Num (gte x y))) ([x y & more] - (when (>= x y) + (if (>= x y) (if (rest more) (recur y (first more) (rest more)) - (>= y (first more)))))) + (>= y (first more))) + false))) (defn - #^{:doc "Returns non-nil if nums all have the same value, otherwise nil"} + #^{:doc "Returns non-nil if nums all have the same value, otherwise false"} == ([x] true) ([x y] (. clojure.lang.Num (equiv x y))) ([x y & more] - (when (== x y) + (if (== x y) (if (rest more) (recur y (first more) (rest more)) - (== y (first more)))))) + (== y (first more))) + false))) (defn #^{:doc "Returns the greatest of the nums."} |