title: Passing a list as a Parameter in Scheme
body: <p>I am a beginner to functional programming and I want to be able to read values from a console into a list, pass that list as a parameter, and then return the sum of the list in Scheme.</p>
  
  <p>I want to get this result: (display (sum-list-members '(1 2 3 4 5))) but the user must enter these values at the console.</p>
  
  <p>This is what I am working on:</p>
  
  <pre class="lang-lisp prettyprint-override"><code>(begin
  
      (define count 0)
  
  
      (define sum-list-members
        (lambda (lst)
          (if (null? lst)
          0
          (+ (car lst) (sum-list-members (cdr lst))))))
  
  
      (display "Enter a integer [press -1 to quit]: ")
      (newline)
  
      (let loop ((i 0))               
  
          (define n(read))
          (sum-list-members (list n))
  
              (set! count i)      
              (if (not(= n -1))               
  
          (loop (+ i 1)))
  
      )
  
      (newline)
  
  )
  </code></pre>