title: writing a function that returns the frequency of a word in a string
body: <p>so for my code I need to write a function that returns the frequency of a word in a string.
  So far I have the following code:</p>
  
  <pre><code>(define (num-occurs sym lst)
    (define (counter sym lst count)
      (cond ((null? lst) count)
            ((equal? (car lst) sym) (counter sym (cdr lst) (+ 1 count)))
            (else (counter sym (cdr lst) count))))
    (counter sym lst 0))
  
  (define (remove-all elem lst)
      (if (null? lst)
          '()
          (if (equal? elem (car lst))   
              (remove-all elem (cdr lst))
              (cons (car lst) (remove-all elem (cdr lst))))))
  
  (define (word-frequencies str)
    (let ((lst (string-&gt;list str)))
    (if (null? lst)
        '()
            (append (list (cons (car lst) (num-occurs (car lst) lst)))
                    (word-frequencies (remove-all (car lst) (cdr lst)))))))
  </code></pre>
  
  <p>when I give it an input like: (word-frequencies "hi there person hi")</p>
  
  <p>I get this error. 
  string->list: contract violation
    expected: string?
    given: (#\i #\space #\t #\e #\r #\e #\space #\p #\e #\r #\s #\o #\n #\space #\i)</p>
  
  <p>Help would be appreciated why it's doing this?
  I want my final output to look like.</p>
  
  <p>(( hi . 2) ( there . 1) ( person . 1))</p>