Hi,

trying to convert some Scala code I have into Clojure and would like as for
a feedback. Following code is suppose to scan a sequence and combine min,
max, sum and count:

user=> (defn combine [x y] (let [[mi ma su co] x] [(min mi y) (max ma y) (+
su y) (+ 1 co)]))
#'user/combine
user=> (defn mimasuco ([x] [x x x 1]) ([x & y] (reduce combine (mimasuco x)
y)))
#'user/mimasuco
user=> (mimasuco 1 2 3 4)
[1 4 10 4]
user=> (mimasuco 100)
[100 100 100 1]


I try to stick to classic scheme like coding but wonder if there is more
Clojure idiomatic way of doing this.

Andy

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