sicp-ex-2.75



<< Previous exercise (2.74) | Index | Next exercise (2.76) >>


meteorgan

It's similar to make-from-real-imag.

 (define (make-from-mag-ang r a) 
   (define (dispatch op) 
         (cond ((eq? op 'real-part) (* r (cos a))) 
               ((eq? op 'imag-part) (* r (sin a))) 
               ((eq? op 'magnitude) r) 
               ((eq? op 'angle) a) 
               (else (error "Unkown op --- MAKE-FROM-MAG-ANG" op)))) 
   dispatch)