title: In scheme I keep getting "Error: ( : 1) car: argument 1 must be: pair", why?
body: <p>I found <a href="http://registry.gimp.org/node/25031" rel="nofollow">this page</a> explaining that some of the gimp functions won't return values consistently, so I implemented a do while loop to make sure the functions are returning pairs before using <code>car</code>. Still, I get the error <code>Error: ( : 1) car: argument 1 must be: pair</code>, but I'm not sure how that's possible as it should keep running the function until it returns a pair.</p>
  
  <pre><code>(define (script-fu-scratchpad drawable)
    (let* ((imgHeight 0)
           (imgWidth)
           (bpp)
           (pixel))
      (set! imgHeight (gimp-drawable-height drawable))
      (do ()
          [(pair? imgHeight)]
        (set! imgHeight (gimp-drawable-height drawable)))
      (set! imgHeight (car imgHeight))
  
      (set! imgWidth (gimp-drawable-width drawable))
      (do ()
          [(pair? imgWidth)]
        (set! imgWidth (gimp-drawable-width drawable)))
      (set! imgWidth (car imgWidth))
  
      (set! bpp (gimp-drawable-bpp drawable))
      (do ()
          [(pair? bpp)]
        (set! bpp (gimp-drawable-bpp drawable)))
      (set! bpp (car bpp))
  
      (display bpp) (newline)
      (set! pixel (cons-array bpp 'byte))
      (aset pixel 0 150)
      (aset pixel 1 150)
      (aset pixel 2 150)
      (aset pixel 3 0)
  
      (gimp-drawable-set-pixel drawable (/ imgHeight 2) (/ imgWidth 2) bpp pixel)
      (gimp-context-set-background '(100 100 100))
      (define county 0)
      (define countx 0)
      (do ()
          [(= countx imgWidth)]
        (do ()
            [(= county imgHeight)]
          (gimp-drawable-set-pixel drawable county countx bpp pixel)
          (set! county (+ county 1)))
        (set! countx (+ countx 1)))))
  </code></pre>
  
  <hr>
  
  <p>In response to GoZoner, I edited it and received the following error: <code>Error: (:1) car: argument 1 must be: pair</code></p>
  
  <pre><code>(define
      (script-fu-scratchpad drawable)
      (let*
          ( 
              (imgHeight 0)
              (imgWidth 0)
              (bpp 0)
              (pixel 0)
          )
  
          (set! imgHeight (gimp-drawable-height drawable))    
          (set! imgWidth (gimp-drawable-width drawable))
  
          (set! bpp (gimp-drawable-bpp drawable))
          (do ()
              [(pair? bpp)]
              (set! bpp (gimp-drawable-bpp drawable))
          )
          (set! bpp (car bpp))
  
          (display bpp) (newline)
          (set! pixel (cons-array bpp 'byte))
          (aset pixel 0 150)
          (aset pixel 1 150)
          (aset pixel 2 150)
          (aset pixel 3 0)
  
          (gimp-drawable-set-pixel drawable (/ imgHeight 2) (/ imgWidth 2) bpp pixel)
          (gimp-context-set-background '(100 100 100))
          (define county 0)
          (define countx 0)
          (do ()
              [(= countx imgWidth)]
              (do ()
                  [(= county imgHeight)]
                  (gimp-drawable-set-pixel drawable county countx bpp pixel)
                  (set! county (+ county 1))
              )
              (set! countx (+ countx 1))
          )
      )
  )
  </code></pre>