combine can be made more succinct by destructuring the input directly:

(defn combine [[mi ma su co] y] [(min mi y) (max ma y) (+ su y) (+ 1 co)])

As for the main function, my tendency would be to avoid taking cases on the
number of args:

(defn mimasuco [& s] (reduce combine [Double/POSITIVE_INFINITY
Double/NEGATIVE_INFINITY 0 0] s))

But overall, yes, this kind of use of reduce is certainly idiomatic.
loop-recur is another option.  Also, you could do something like this which
is nice and clear (works on sequence, not variable args) but it would be
slower:

(def mimasuco (juxt #(apply min %) #(apply max %) #(apply + %) count))

All reasonable approaches, I think.

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to