user=> (def a (group-by first [[1 0.5] [1 0.7] [2 1.0] [3 0.1] [3 0.1]]))
#'user/a
user=> (for [[k vs] a] [k (apply + (map second vs))])
([1 1.2] [2 1.0] [3 0.2])


On Thu, Mar 19, 2015 at 3:41 PM, Alex <[email protected]> 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 [email protected]
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> [email protected]
> 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 [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
[email protected]
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to