try the following:

(defn avg-coll [coll] (/ (reduce + coll) (count coll)))

then use it on your collection of collections:

(map #(avg-coll %) (list (list 1 2 3) (list 6 4 2)))

this will give you (2 4)

hope this helps.

On Apr 12, 10:48 pm, Glen Rubin <rubing...@gmail.com> wrote:
> I am working with a collection of integer sequences ...(e.g.
> coll:
> ((3 7 3 5 9 2 0 8 4 0 1 2323 4 11...) (243 4 664 478 3948...) (6 3 7 4
> 3335 2 4 5 7 6...)...)
>
> I want to create an average sequence such that all of the first
> elements are averaged, all of the second elements, etc....
>
> However, I am unable to manipulate the collection.  If I try something
> simple like:
>
> (map + coll)
>
> I get java.lang.ClassCastException
>
> I understand that this is because map is trying to apply + to an
> entire sequence, but cannot figure out how to remove the parenthesis
> which enclose this collection.

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

To unsubscribe, reply using "remove me" as the subject.

Reply via email to