> A little stuck on how to do this efficiently. I have data that looks
> like this
>
> ( [ [1 2] [3 4] [5 6] ... ] [ [5 6] [7 8] [9 0] ... ] ...)
>
> I am trying to sum the vector pairs, e.g
>
> [6 8] [10 12] [14 6]
Try:
user> (def all-pairs '([ [1 2] [3 4] [5 6] ] [[5 6] [7 8] [9 0]]) )
#'user/all-pairs
user> (defn sum-vec [& pts]
(apply vector (apply map + pts)))
#'user/sum-vec
user> (apply map sum-vec all-pairs)
([6 8] [10 12] [14 6])
user>
U
--
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