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
that returns the product of the values of a function at points over a given range. Show how to define
in terms of 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
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.
You must log in to post a comment.Login
(define (inc n) (+ n 1)) (define (square x) (* x x)) (define (identity x) x) (check-equal? (product square 1 inc 3) 36) (check-equal? (product identity 3 inc 5) 60) (check-equal? (factorial 5) 120)