title: Maintaining list structure when duplicating
body: <p>I am writing a function to duplicate all the items in a list, so that a list like (a (b c)) becomes (a a (b b c c)), however my function returns (a a b b c c). How do I ensure I retain the internal list structure? Here is my current code:</p>
  
  <pre><code>(define double
    (lambda (l)
      (cond ((null? l) '())
            ((list? l) (append (double (car l)) (double (cdr l))))
            (else (append (list l) (list l)) )
      )
  ))
  </code></pre>