SICP-2nd-Edition-Exercise-1.30

From Boozled

Jump to: navigation, search

Contents

Exercise 1.30 From SICP

Details from SICP are here

The (sum) procedure above generates a linear recursion. The procedure can be rewritten so that the sum is performed iteratively. Show how to do this by filling in the missing expressions in the following definition:

  1.  


Attempt

I changed the names of some of the internal functions in my answer because it seemed easier to think of the function calculating something using a than a as just a term. It's strange that this actually made it easier for me to think about the question.

Scheme

  1.  

Parent Course

6.001_Structure_and_Interpretation_of_Computer_Programs

Further Reading

Personal tools