title: Converting a recursive function to a tail recursive function in Scheme
body: <p>I have a function:</p>
  
  <pre><code>;; Converting list of integers to a bit string
  (define (convert-integers-to-bits integer-representation-of-bits)
    (if (null? integer-representation-of-bits)
      '#*
      (bit-string-append 
        (convert-integers-to-bits (cdr integer-representation-of-bits))
        (unsigned-integer-&gt;bit-string 1 (car integer-representation-of-bits)))))
  </code></pre>
  
  <p>When I run it on small lists, it works, but on real files, it gives me the warning: </p>
  
  <pre><code>;Aborting!: maximum recursion depth exceeded
  </code></pre>
  
  <p>Sample usage:</p>
  
  <pre><code>]=&gt; (convert-integers-to-bits '(1 1 0 1 0 1))
  ;Value: #*110101
  </code></pre>
  
  <p>Is converting it to a tail recursive function the solution here? If so, any ideas would be appreciated. Thank you.</p>