Consider using core.matrix for such things.
It will manipulate nested vectors quite efficiently as matrices, but it also has much more powerful material if you need it (for example, support for accelerated libraries of native matrices via JBLAS). It is formed as the final library / API for calculating matrices in Clojure.
In this case, you can simply use "emap" to apply the functional element to the two matrices:
(use 'core.matrix) (def cym '[[ccc] [yyy] [mmm]]) (def rgb '[[rgb] [rgb] [rgb]]) (emap vector cym rgb) => [[[cr] [cg] [cb]] [[yr] [yg] [yb]] [[mr] [mg] [mb]]]
mikera
source share