title: Insert node key and value in binary search tree using scheme
body: <p>I am inserting a key <code>key</code> and a value <code>val</code> into the tree-map <code>t</code> returning a new tree with a node containing the key and the value in the appropriate location.</p>
  
  <p>I have this defined:</p>
  
  <pre><code>(define (tree-node key value left right)(list key value left right))
  
  (define (get-key tn) (node_key tn))
  (define (get-val tn) (node_val tn))
  (define (get-left tn) (node_left tn))
  (define (get-right tn) (node_right tn))
  
  (define (node_key tn) (list-ref tn 0))
  (define (node_val tn) (list-ref tn 1))
  (define (node_left tn) (list-ref tn 2))
  (define (node_right tn) (list-ref tn 3))
  </code></pre>
  
  <p>Im trying this <code>insert</code> method </p>
  
  <pre><code>(define (insert t key val)
  
    (cond (empty? t))
    (tree-node (key val '() '()))
  
    ((equal key (get-key t))
     (tree-node (key val (get-left t) (get-right t)))
  
     ((&lt;key (get-key t))
      (tree-node ((get-key t) (get-val t) (insert (get-left t key val)) (get-right t)))
      (tree-node ((get-key t) (get-val t) (get-left t) (insert (get-right t key val)))))))
  </code></pre>
  
  <p>I'm using this to define</p>
  
  <pre><code>(define right (insert (insert empty 3 10) 5 20))
  </code></pre>
  
  <p>and I'm getting this error in DrRacket</p>
  
  <pre><code>application: not a procedure;
  expected a procedure that can be applied to arguments
  given: (list 0 1 2)
  arguments...: [none]
  </code></pre>