On Wed, Aug 25, 2010 at 7:06 AM, Glen Rubin <[email protected]> wrote:
> After toying around at the REPL I realize that I have been working
> with a heretofore invalid understanding of collections.  For example,
> working with the following collection(s):
>
> signal:
> (((1 2 3 4) (2 3 4 5) (3 4 5 6)) ((3 4 5 6) (4 5 6 7) (5 6 7 8)))
>
> I wanted to sum each individual list: e.g. (1 2 3 4) = (10)
>
> I thought I could do this as follows:
>
> (map #(map reduce + %) signal)
>
> This resulted in an error, so trying to comprehend why I ran the
> following:
>
> (map #(map identity (take 1 %)) signal)
>
> which results in,
> (((1 2 3 4)) ((3 4 5 6)))
>
> So, clojure sees 'signal' as 2 collections, whereas I thought it was a
> single collection.  This makes me concerned that I have been doing
> everything wrong thus far and getting computational errors. :(  So,
> how should I sum each individual list in the above collections?
>

I would suggest you to learn either F#(the IDE is the best) or Haskell
in parallel. Both of them are typed language which would give you a
better clue of what is going on here and the map/reduce thing is
basically the same.

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

Reply via email to