Answered step by step
Verified Expert Solution
Link Copied!

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.

image text in transcribed

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Linked Data A Geographic Perspective

Authors: Glen Hart, Catherine Dolbear

1st Edition

1000218910, 9781000218916

More Books

Students also viewed these Databases questions

Question

Athabas University Overview of C Fine FNCE 30

Answered: 1 week ago

Question

How do modern Dashboards differ from earlier implementations?

Answered: 1 week ago