Question: That is a pi calculating program in scheme. Is there a way to get rid of if and put cond there? (define (pi err) (let

That is a pi calculating program in scheme. Is there a way to get rid of "if" and put "cond" there?

(define (pi err) (let loop ([n 0] [prev +nan.0] [cur 0.0]) (cond ((< (abs (- cur prev)) (/ err4.0)) (* 4.0 prev)) (else(loop (add1 n) cur ((if (even? n) + -) cur (/ 1.0 (+ 1.0 n n))))))))

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!