Skip to content

Commit e890a56

Browse files
committed
Skip 2.74. And 2.75 is finished.
1 parent 3a5b061 commit e890a56

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

2.75.scm

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
(define (apply-generic op arg) (arg op))
2+
3+
(define (make-from-real-imag x y)
4+
(define (dispatch op)
5+
(cond ((eq? op 'real-part) x)
6+
((eq? op 'imag-part) y)
7+
((eq? op 'magnitude)
8+
(sqrt (+ (square x) (square y))))
9+
((eq? op 'angle) (atan y x))
10+
(else
11+
(error "Unknown op:
12+
MAKE-FROM-REAL-IMAG" op))))
13+
dispatch)
14+
15+
(define (make-from-mag-ang r a)
16+
(define (dispatch op)
17+
(cond ((eq? op 'real-part) (* r (cos a)))
18+
((eq? op 'imag-part) (* r (sin a)))
19+
((eq? op 'magnitude) r)
20+
((eq? op 'angle) a)
21+
(else (error "Unknown op: MAKE-FROM-REAL-IMAG" op))))
22+
dispatch)

0 commit comments

Comments
 (0)