title: How to manipulate scheme binary trees
body: <p>I am trying to write a scheme program that inputs a specific depth of a binary tree. For example, the root of a binary tree is 1 and then the root of the left sub tree is 2 and so on and on. I am supposed to make it output the data expression that has the depth in the tree. Right now I have the code below, but I am continuously getting error message:</p>
  
  <pre><code>Error in null?: expected a list; got '1'.
  </code></pre>
  
  <p>If you could explain this using the same terms in the code that I am using it would be great as I am learning and I do not know how to use some of the bigger expressions. </p>
  
  <p>This is the code</p>
  
  <pre><code>(define fetch-exp
    (λ (n bt)
      (cond [(empty-tree? bt) ▽#f]
            [(&gt; n (tree-depth (left-tree bt))) ▽#f]
            [(&gt; n (tree-depth (right-tree bt))) ▽#f]
            [(one? n) (root bt)]
            [(&gt; (tree-depth (left-tree bt)) (tree-depth (right-tree bt)))
             (fetch-exp (left-tree bt) (sub1 n))]
            [(&gt; (tree-depth (right-tree bt)) (tree-depth (left-tree bt)))
             (fetch-exp (right-tree bt) (sub1 n))]
            [else ▽#f])))
  </code></pre>