Question: SCHEME LANG. Here are Bert's definitions for complex numbers (define (make-complex-from-rect rl im) (list rl im)) (define (make-complex-from-polar mg an) (list ( mg (cos an))
SCHEME LANG.

Here are Bert's definitions for complex numbers (define (make-complex-from-rect rl im) (list rl im)) (define (make-complex-from-polar mg an) (list ( mg (cos an)) (mg (sin an)))) (define (real cx) (car cx)) (define (imag cx) (cadr cx)) (define (mag cx) (sqrt ((square (real cx)) (square (imag cx)))) (define (angle cx) (atan (imag cx) (real cx))) Suppose Bert makes the following change to his system (define (make-complex-from-rect rl im) (cons rl im)) For each of the following choices (which you should treat independently) check if the changes would be sufficient to make the complex number system work properly (Note that work properly means that abstraction barriers are still preserved.) 1. Change imag to use cdr 2. Change make-complex-from-polar to also use cons 3. Change k-omplex-from-polar to also use cons, and change imag to use cdr 4. Change make-complex-from-polar to also use cons, and change imag, mag and angle to use cdr 5. Nothing needs to change Here are Bert's definitions for complex numbers (define (make-complex-from-rect rl im) (list rl im)) (define (make-complex-from-polar mg an) (list ( mg (cos an)) (mg (sin an)))) (define (real cx) (car cx)) (define (imag cx) (cadr cx)) (define (mag cx) (sqrt ((square (real cx)) (square (imag cx)))) (define (angle cx) (atan (imag cx) (real cx))) Suppose Bert makes the following change to his system (define (make-complex-from-rect rl im) (cons rl im)) For each of the following choices (which you should treat independently) check if the changes would be sufficient to make the complex number system work properly (Note that work properly means that abstraction barriers are still preserved.) 1. Change imag to use cdr 2. Change make-complex-from-polar to also use cons 3. Change k-omplex-from-polar to also use cons, and change imag to use cdr 4. Change make-complex-from-polar to also use cons, and change imag, mag and angle to use cdr 5. Nothing needs to change
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
