previous | index | next

Processing Lists: Summing Integers

Q: What is the sum of the integers in an empty list?

A: 0

Q: What is the sum of the integers in a nonempty list?

A: The head of the list plus the sum of the integers in the tail.

     (define sum
       (lambda (lst)
         (if __?__
             __?__
             __?__ )))

previous | index | next