Suppose I've got:
'[[c c c]
[y y y]
[m m m]]
and
'[[r g b]
[r g b]
[r g b]]
and I'd like to have:
'[[[c,r] [c,g] [c,b]]
[[y,r] [y,g] [y,b]]
[[m,r] [m,g] [m,b]]]
What is the elegant way to do this in clojure?
(def a '[[c c c]
[y y y]
[m m m]])
(def b '[[r g b]
[r g b]
[r g b]])
(mapv (partial mapv vector) a b) ;; will work with arbitrary number
;; of equal sized arguments
;=> [[[c r] [c g] [c b]] [[y r] [y g] [y b]] [[m r] [m g] [m b]]]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With