Yet another way to solve it:
*user=> x[[1 0.5] [1 0.7] [2 1.0] [3 0.1] [3 0.1]]user=> (group-by first x){1 [[1 0.5] [1 0.7]], 2 [[2 1.0]], 3 [[3 0.1] [3 0.1]]}user=> (map #(vector (first %) (second %)) (group-by first x))([1 [[1 0.5] [1 0.7]]] [2 [[2 1.0]]] [3 [[3 0.1] [3 0.1]]])user=> (map #(vector (first %) (reduce + (map second (second %)))) (group-by first x))([1 1.2] [2 1.0] [3 0.2])* All the best, Emrehan On Thursday, 19 March 2015 23:57:18 UTC+2, Alex wrote: > > Hello everybody, > > How to transform sequence > > *[[1 0.5] [1 0.7] [2 1.0] [3 0.1] [3 0.1]]* > > to > > *[[1 1.2] [2 1.0] [3 0.2]]* > > ? > > Best regards, > Alex > > -- 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.