title: Scheme binary search tree
body: <p>I have already defined helper functions to be:</p>
  
  <pre><code>;; returns value of node
  (define (value node)
    (if (null? node) '()
        (car node)))
  
  ;; returns left subtree of node
  (define (left node)
    (if (null? node) '()
        (cadr node)))
  
  ;; returns right subtree of node
  (define (right node)
    (if (null? node) '()
        (caddr node)))
  </code></pre>
  
  <p>and I am trying to write a function <code>leaves</code> that returns a list with the leaves of the tree in order of left to right.</p>
  
  <pre><code>(define (leaves tree)
      (if (and (?null (left tree)) (?null (right tree)))
          ???
          (leaves (left tree)) (leaves (right tree))))
  </code></pre>
  
  <p>but that is as far as I can get </p>
  
  <p>ex: (leaves '(1 (2 () ()) (3 () ()))) should evaluate to '(2 3)</p>