title: Find and replace in scheme
body: <p>I need to write a scheme program that finds and replaces a given pattern and I've gotten it to work on only one layer of nesting but when the next car from the list is a list itself, my program doesn't properly recurse in it.</p>
  
  <p>Here is what I have so far:</p>
  
  <pre><code>(define replace 
      (lambda (source target replacement) 
          (if (eqv? source target)
              replacement
              (if (null? source)
                  '() ;;base case
  
                  (if (equal? target (car source))
                      (cons replacement (replace (cdr source) target replacement))
  
                      (cons (car source)
                      (replace (cdr source) target replacement))
                  )
              )
          )
      )
  )
  </code></pre>