title: scheme structures and lists
body: <pre><code>(define-struct position (name numshares share-price))
  
  (define p1
  (cons (make-position "INT" 10 192) (cons (make-position "SSS" 4 42) 
  empty)))
  </code></pre>
  
  <p><code>mult</code> is my helper function          </p>
  
  <pre><code>(define (mult  n)
       ( * (position-numshares n) 
       (position-share-price n)))
  </code></pre>
  
  <p>const takes the position-numshares and the position-share-price in a list and multiplies them together. </p>
  
  <pre><code>(define (const n)
    (cond
      [(empty? n) empty]
  
       [(cons? n)
         (+ (mult (first n))
                  )]))
  </code></pre>
  
  <p>What I would like to do is take the first of the list and add the rest of the list together. Instead, I only get the first of the list. So if I do (const p1) I only get 1920, but I would like to get 2088 (10*192 + 4*42).  I've tried recurring for the rest, but get an error. I am probably missing something simple. Help would be appreciated. </p>