You could first turn the Values from String into Double like this: (defn step1 [coll] (map (fn [m] (assoc m "Value" (Double/parseDouble (m "Value")))) coll))
Next, you can use reduce to calculate the sum per Value: (defn step2 [coll] (reduce (fn [res m] (let [k (m "Type") v (m "Value")] (assoc res k (+ v (get res k 0))))) {} coll)) This yields a map: {"B" 6.982, "A" 37.599999999999994} Finally, this map can be turned into the list that you want: (defn step3 [m] (map (fn [[k v]] {"Type" k "Value" (format "%.3f" v)}) m)) The steps can be rolled into one function like this: (defn der [coll] (-> coll step1 step2 step3)) -- 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