summaryrefslogtreecommitdiff
path: root/coding-exercises/2/78
diff options
context:
space:
mode:
Diffstat (limited to 'coding-exercises/2/78')
-rw-r--r--coding-exercises/2/78/install-complex-package.rkt3
1 files changed, 3 insertions, 0 deletions
diff --git a/coding-exercises/2/78/install-complex-package.rkt b/coding-exercises/2/78/install-complex-package.rkt
index e332351..335eacd 100644
--- a/coding-exercises/2/78/install-complex-package.rkt
+++ b/coding-exercises/2/78/install-complex-package.rkt
@@ -53,6 +53,9 @@
(put 'add '(complex complex)
(lambda (z1 z2) (typetag (add-complex z1 z2))))
+ (put 'neg '(complex)
+ (lambda (z) (typetag (make-from-real-imag (- (real-part z))
+ (- (imag-part z))))))
(put 'sub '(complex complex)
(lambda (z1 z2) (typetag (sub-complex z1 z2))))
(put 'mul '(complex complex)