title: Racket, get a value from a list using an index
body: <p>I want to get a element from a list giving an index. But the index will by get trough another function:</p>
  
  <pre><code>    #lang racket
  
  (define (list-index e lst)
      (if (null? lst)
          0
          (if (equal? (car lst) (car e))
              1
              (+ 1 (list-index e (cdr lst))))))
  
  
  (list-ref '(aa bb cc dd ee ff) (list-index e lst))
  </code></pre>
  
  <p>Example:
  If I execute: (list-index '(c) '(a b c d)) this returns "3" and now I want to use that number to get "cc" in the second funtion with the list '(aa bb cc dd ee ff).</p>
  
  <p>The issues are:</p>
  
  <ul>
  <li><p>The (list-index e lst) is giving an error in the second function.</p></li>
  <li><p>I dont know how to combine both funtions.</p></li>
  </ul>