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. 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 product . Also use this procedure to compute approximations to π using the formula

    π     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.