Created
May 8, 2013 05:07
-
-
Save jimmyp/5538332 to your computer and use it in GitHub Desktop.
Ex 1.3 SICP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(define (max1 a b c) | |
(cond ((and (> a b)(> b c)) a) | |
((and (> a b)(> c b)) a) | |
(else c))) | |
(define (max2 a b c) | |
(cond ((and (> a b)(> b c)) b) | |
((and (> a b)(> c b)) c) | |
(else b))) | |
(define (square x) (* x x)) | |
(define (sum-square a b) (+ (square a) (square b))) | |
(define (sum-square-max2 a b c) (sum-square (max1 a b c)(max2 a b c))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment