Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started