diff options
-rw-r--r-- | src/clj/clojure/core.clj | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/clj/clojure/core.clj b/src/clj/clojure/core.clj index fdfd37a8..ade4405c 100644 --- a/src/clj/clojure/core.clj +++ b/src/clj/clojure/core.clj @@ -770,7 +770,19 @@ [x] (. clojure.lang.Numbers (inc x))) ;; reduce is defined again later after InternalReduce loads -(def reduce +(def + ^{:arglists '([f coll] [f val coll]) + :doc "f should be a function of 2 arguments. If val is not supplied, + returns the result of applying f to the first 2 items in coll, then + applying f to that result and the 3rd item, etc. If coll contains no + items, f must accept no arguments as well, and reduce returns the + result of calling f with no arguments. If coll has only 1 item, it + is returned and f is not called. If val is supplied, returns the + result of applying f to val and the first item in coll, then + applying f to that result and the 2nd item, etc. If coll contains no + items, returns val and f is not called." + :added "1.0"} + reduce (fn r ([f coll] (let [s (seq coll)] |