Ah, so this is the context for your previous thread about multiplying lists. Re-using some of the code from that thread:
(def target [[1 2 3 4] [2 3 4 5]]) (def signal [[[1 2 3 4] [2 3 4 5] [3 4 5 6]] [[2 3 4 5] [3 4 5 6] [4 5 6 7]]]) (defn correlate [target signal] (let [mult-lists (fn [x y] (map * x y)) mult-list-by-lists (fn [l ls] (map #(mult-lists l %) ls))] (map mult-list-by-lists target signal))) user=> (correlate target signal) (((1 4 9 16) (2 6 12 20) (3 8 15 24)) ((4 9 16 25) (6 12 20 30) (8 15 24 35))) On Aug 23, 9:26 am, Glen Rubin <rubing...@gmail.com> wrote: > I am trying to write a fn to correlate 2 signals using 3 nested map > fn. I have 2 collections of data. THe first group of signals called > target looks something like this. > > target: > ( (1,2,3,4) (2,3,4,5) ...) > > The second collection is called signal and looks like this: > > signal: > ( ((1,2,3,4)(2,3,4,5)(3,4,5,6)) ((2,3,4,5)(3,4,5,6)(4,5,6,7)) ... ) > > I would like to take the first list in "target" and multiply it by > every list in the first group of "signal". And then continue on > processing the second list, etc... > > which would result in something like: > > ( ((1,4,9,16)(2,6,12,20)(3,8,15,24)) ((4,9,16,25) (6,12,20,30) > (8,15,24,35)) ... ) > > I try a nested map fns like this, but can't get it to work: > > (map #(map #(map * %1 %2) %1 %2) target signal) -- 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