title: Trying to implement a method to square a tree gives error 4 parts after keyword
body: <p>I am trying to implement a method that has the ability to square a list that can consists of sub lists (a tree) using map.</p>
  
  <p>This means that <code>(square-tree-map (list 1 3 (list 3 4)))</code> should return <code>(1 9 (9 16))</code>.</p>
  
  <p>I came up with this code:</p>
  
  <pre><code>(define (square-tree-map tree)
    (define (sq x) (* x x))
    (map (lambda (t) 
           (if (pair? t) 
               (cons (square-tree-map (car t))
                     (square-tree-map (cdr t)))
               sq t)) 
         tree))
  </code></pre>
  
  <p>This gives the error:</p>
  
  <blockquote>
    <p>if: bad syntax;
     has 4 parts after keyword in: (if (pair? t) (cons (square-tree-mapped (car t)) (square-tree-mapped (cdr t))) sq t)</p>
  </blockquote>
  
  <p>I only see two possibilities after the if operator, not 4. Why do I get this error? </p>