1.3.1. Procedures as Arguments
Exercise 1.31

Higher-order procedures

a. The sum procedure is only the simplest of a vast number of similar abstractions that can be captured as higher-order procedures.51 Write an analogous procedure called product that returns the product of the values of a function at points over a given range. Show how to define factorial in terms of product. Also use product to compute approximations to using the formula(52)


    π     2·4·4·6·6·8···
    -  =  --------------
    4     3·3·5·5·7·7···

b. If your product procedure generates a recursive process, write one that generates an iterative process. If it generates an iterative process, write one that generates a recursive process.



There are no comments yet.

Authentication required

You must log in to post a comment.

Login