From: Ramakrishnan Muthukrishnan Date: Mon, 20 Sep 2010 16:50:56 +0000 (+0530) Subject: solution to 2.75 X-Git-Url: https://git.rkrishnan.org/pf/content/simplejson/frontends/flags/nxhtml.html?a=commitdiff_plain;h=51836715aef17aa5a62da135a3475b9ae420231e;p=sicp.git solution to 2.75 --- diff --git a/src/sicp/ex2_75.rkt b/src/sicp/ex2_75.rkt new file mode 100644 index 0000000..0af9920 --- /dev/null +++ b/src/sicp/ex2_75.rkt @@ -0,0 +1,12 @@ +#lang racket + +(define (make-from-mag-ang r a) + (define (dispatch op) + (cond + [(eq? op 'magnitude) r] + [(eq? op 'angle) a] + [(eq? op 'real-part) (* r (cos a))] + [(eq? op 'imag-part) (* r (sin a))])) + dispatch) + + \ No newline at end of file