You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
459 B
19 lines
459 B
|
|
Exercise 3.1: An
|
|
accumulator is a
|
|
procedure that is called repeatedly with a single numeric argument and
|
|
accumulates its arguments into a sum. Each time it is called, it returns the
|
|
currently accumulated sum. Write a procedure make-accumulator that
|
|
generates accumulators, each maintaining an independent sum. The input to
|
|
make-accumulator should specify the initial value of the sum; for
|
|
example
|
|
|
|
|
|
(define A (make-accumulator 5))
|
|
|
|
(A 10)
|
|
15
|
|
|
|
(A 10)
|
|
25
|
|
|
|
|