title: gimp - creating layers 2d list
body: <p>Hello I am trying to convert a bunch of layers ( drawables + masks ) into a 2d list for random access using list-ref. I have failed and I cant see where I am going wrong. The cmyk-list contains garbage. All drawables have been tested with this example template (gimp-invert magenta-layer-copy) before creating the list Your help, comments appreciated.</p>
  
  <pre><code>(set! layerList (cadr (gimp-image-get-layers image)))           
  (set! number-of-layers (vector-length layerList))
  
  (set! cyan-layer-copy       (aref layerList (- number-of-layers 4)))
  (set! cyan-mask-copy        (car (gimp-layer-get-mask cyan-layer-copy)))
  (set! magenta-layer-copy    (aref layerList (- number-of-layers 3)))
  (set! magenta-mask-copy     (car (gimp-layer-get-mask magenta-layer-copy)))
  (set! yellow-layer-copy     (aref layerList (- number-of-layers 2)))
  (set! yellow-mask-copy      (car (gimp-layer-get-mask yellow-layer-copy)))
  (set! alpha-layer-copy      (aref layerList (- number-of-layers 1)))
  
  (set! cmyk-list     '((cyan-layer-copy cyan-mask-copy)
                      (magenta-layer-copy magenta-mask-copy)
                      (yellow-layer-copy yellow-mask-copy)
                      (alpha-layer-copy  0)))                             
  </code></pre>