diff options
author | Rich Hickey <richhickey@gmail.com> | 2007-12-13 18:53:40 +0000 |
---|---|---|
committer | Rich Hickey <richhickey@gmail.com> | 2007-12-13 18:53:40 +0000 |
commit | eda0f80dd1b8a487d84e67beb7960d3f1f61e370 (patch) | |
tree | 0cfac341494b0e1587e71307a268ad798c5ba5d4 /src | |
parent | e17195ed53827b8a0c2b236cb4c18e5b48fc8d0b (diff) |
added min and max
Diffstat (limited to 'src')
-rw-r--r-- | src/boot.clj | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/boot.clj b/src/boot.clj index 3618ce0d..ad43cb53 100644 --- a/src/boot.clj +++ b/src/boot.clj @@ -234,6 +234,18 @@ (recur y (first more) (rest more)) (thisfn y (first more)))))) +(defn max + ([x] x) + ([x y] (if (> x y) x y)) + ([x y & more] + (reduce thisfn (thisfn x y) more))) + +(defn min + ([x] x) + ([x y] (if (< x y) x y)) + ([x y & more] + (reduce thisfn (thisfn x y) more))) + (defn inc [x] (. clojure.lang.Num (inc x))) @@ -910,5 +922,6 @@ aget aset aset-boolean aset-int aset-long aset-float aset-double aset-short aset-byte make-array macroexpand-1 macroexpand + max min )) |