Skip to content
Browse files

Add solution to 2_77

  • Loading branch information...
1 parent 96e4b59 commit 72b9e2a7f4610bcbc504cb4fb3127132fe7031ed @fastred committed
Showing with 17 additions and 0 deletions.
  1. +17 −0 2_77.scm
View
17 2_77.scm
@@ -0,0 +1,17 @@
+;z equals (cons 'complex (cons 'rectangular (cons 3 4)))
+(magnitude z)
+(apply-generic 'magnitude z)
+(magnitude (contents z))
+(magnitude (cons 'rectangular (cons 3 4)))
+(apply-generic 'magnitude (cons 'rectangular (cons 3 4)))
+(magnitude (cons 3 4)) ; from rectangular package
+(sqrt (+ (square (real-part (cons 3 4)))
+ (square (imag-part (cons 3 4)))))
+(sqrt (+ (square (car (cons 3 4)))
+ (square (cdr (cons 3 4)))))
+(sqrt (+ (square 3)
+ (square 4)))
+(sqrt (+ 9 16))
+(sqrt 25)
+5
+

0 comments on commit 72b9e2a

Please sign in to comment.
Something went wrong with that request. Please try again.