title: Scheme: How to find a position of a char in a string
body: <p>I am trying to find the index of a string where it is equal to a certain character, but I can seem to figure it out. 
  This is what I got so far, but its not working...</p>
  
  <pre><code>(define getPos 
    (lambda ()
      (define s (apply string-append myList))
      (getPosition pos (string-&gt;list s))))
  
  (define getPosition 
    (lambda (position s)
      (if (and (&lt; position (length s)) (equal? (car s) #\space)) 
          ((set! pos (+ pos 1)) (getPosition (cdr s) pos));increment the positon and continue the loop
          pos)));else
  
  (define length
    (lambda (s);the value s must be coverted to a string-&gt;list when passed in
      (cond
        ((null? s) 0)
        (else (+ 1 (length (cdr s)))))))
  </code></pre>