Passing a list as a Parameter in Scheme
Posted on 2013-11-02
I am a beginner to learning the Scheme programming language and I want to be able to read values from a console into a list, pass the list as a parameter, and return the sum of that list.
I want to get this result: Ex (display (sum-list-members '(1 2 3 4 5))) but the user must enter these values at the console.
This is what I am working on.
(define count 0)
(if (null? lst)
(+ (car lst) (sum-list-members (cdr lst))))))
(display "Enter a integer [press -1 to quit]: ")
(let loop ((i 0))
(sum-list-members (list n))
(set! count i)
(if (not(= n -1))
(loop (+ i 1)))