title: Recursive function in Scheme
body: <p>I need to make a recursive function that takes an object and a vector and returns a list of all the objects that preceded my object parameter.</p>
  
  <p>I did it using iteration like this:</p>
  
  <pre><code>(define (precedes obj vec)
    (do ((i 1 (+ i 1))
        (list '() (if (eqv? obj (vector-ref vec i))
              (cons(vector-ref vec (- i 1)) list)
              list)))
      ((= i (vector-length vec)) list))
  )
  </code></pre>
  
  <p>but I'm having a lot of trouble trying to figure out how to do the same thing using recursion. I'm confused how I can keep incrementing through the vector as I recursively call. So far, all I have is this:</p>
  
  <pre><code>(define (precedes2 obj vec)
    (define list '())
    (if (eqv? obj (vector-ref vec i))
        (cons(vector-ref vec(- i 1)) list)
        list)))
  </code></pre>
  
  <p>I figured I would use the same logic I used before in terms of the if statement, but I'm not sure how to now call the same function with the updated vector. Any help would be great.</p>