[plt-scheme] trying to make a function that adds a list

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Sun Feb 18 15:25:07 EST 2007

On Feb 17, 2007, at 2:23 PM, trista wrote:

> The assignment is as follows:
>
> Write a Scheme functin that accepts an accumulating functin
> (summation, product) and a list of numbers and returns the
> accumulation of the operation on each element of the list.  If the
> list '(1 2 3 4 ) was supplied and an operatin "sum" that adds two
> elements, the function should return the sum of the list.


Your assignment statement is flawed. The function should also consume  
the identity element for the accumulation operation. (And nobody  
should assign this as a second problem in Scheme.) -- Matthias





Posted on the users mailing list.